API
Modules
Types and constants
LegendGeSim.CC4LegendGeSim.DAQLegendGeSim.DAQLegendGeSim.ElecChainLegendGeSim.ElecChainLegendGeSim.EnvironmentLegendGeSim.FADCLegendGeSim.FADCLegendGeSim.FlashcamLegendGeSim.GenericDAQLegendGeSim.GenericDAQLegendGeSim.GenericElecChainLegendGeSim.GenericElecChainLegendGeSim.GenericFADCLegendGeSim.GenericFADCLegendGeSim.GenericPreAmpLegendGeSim.GenericPreAmpLegendGeSim.NoiseFromDataLegendGeSim.NoiseFromDataLegendGeSim.NoiseFromSimLegendGeSim.NoiseModelLegendGeSim.NoiseModelLegendGeSim.PSSimulatorLegendGeSim.PreAmpLegendGeSim.PreAmpLegendGeSim.SSDSimulatorLegendGeSim.SiggenSimulatorLegendGeSim.StruckLegendGeSim.TrapFilterLegendGeSim.TrapFilterLegendGeSim.TriggerLegendGeSim.Trigger
Functions and macros
LegendGeSim.add_tail_and_baselineLegendGeSim.baseline_catalogLegendGeSim.baseline_catalogLegendGeSim.construct_ssd_simulationLegendGeSim.differentiateLegendGeSim.extend_baselineLegendGeSim.fano_noiseLegendGeSim.fano_noiseLegendGeSim.filenameLegendGeSim.group_by_columnLegendGeSim.impurity_density_modelLegendGeSim.impurity_density_modelLegendGeSim.pet_to_rawLegendGeSim.pet_to_stpLegendGeSim.preamp_gainLegendGeSim.preamp_gainLegendGeSim.process_waveformsLegendGeSim.pss_to_rawLegendGeSim.read_petLegendGeSim.remove_negativeLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulateLegendGeSim.simulate_noiseLegendGeSim.simulate_noiseLegendGeSim.simulate_waveformsLegendGeSim.stp_to_pssLegendGeSim.trigger_thresholdLegendGeSim.trigger_threshold
Documentation
LegendGeSim.LegendGeSim — Module
LegendGeSimTemplate for Julia packages.
LegendGeSim.CC4 — Type
CC4 circuit model (ToDo)
LegendGeSim.DAQ — Type
The DAQ supertype corresponds to the component of the DAQ and electronics setup that saves the waveform after it triggered
LegendGeSim.DAQ — Method
DAQ(sim_conf)LegendGeSimConfig -> <DAQ>
Construct a DAQ supertype struct based on given simulation configuration. Type of returned instance depends on settings in <sim_conf> Currently only one type of DAQ available (GenericDAQ), rendering this function temporarily redundant.
LegendGeSim.ElecChain — Type
The ElecChain supertype corresponds to the chain of electronic components involved in the DAQ setup that appear before the trigger.
LegendGeSim.ElecChain — Method
ElecChain(sim_conf)LegendGeSimConfig -> <ElecChain>
Construct an ElecChain supertype struct based on given simulation configuration. Type of returned instance depends on settings in <sim_conf> Currently only one type of ElecChain available (GenericElecChain), rendering this function temporarily redundant.
LegendGeSim.Environment — Method
Simulation parameters related to the environment
LegendGeSim.FADC — Type
The FADC supertype corresponds to the FADC component of the electronics chain in the DAQ setup.
LegendGeSim.FADC — Method
FADC(sim_conf)LegendGeSimConfig -> <FADC>
Construct an FADC supertype instance based on simulation configuration <simconf>. Type of <FADC> depends on the type specified in <simconf> (e.g. generic, Flashcam, Struck)
LegendGeSim.Flashcam — Type
FADC with Flashcam algorithm (ToDo)
LegendGeSim.GenericDAQ — Type
GenericDAQ is a dummy DAQ model that stores the waveform after it triggered, saving <baseline_length> samples before the trigger index, and in total <nsamples> samples from start to end
LegendGeSim.GenericDAQ — Method
GenericDAQ(sim_conf)LegendGeSimConfig -> GenericDAQ
Construct a GenericDAQ struct based on given simulation configuration
LegendGeSim.GenericElecChain — Type
Generic electronics chain consisting of a preamplifier and an FADC module
LegendGeSim.GenericElecChain — Method
GenericElecChain(sim_conf)LegendGeSimConfig -> GenericElecChain
Construct electronics components based on simulation configuration <sim_conf> and create a GenericChain instance based on these components.
LegendGeSim.GenericFADC — Type
GenericFADC is a dummy FADC model that performs sampling of the input waveform based on the sampling interval <Δt>
LegendGeSim.GenericFADC — Method
GenericFADC(sim_conf)LegendGeSimConfig -> GenericFADC
Construct a GenericFADC instance based on simulation configuration <sim_conf>
LegendGeSim.GenericPreAmp — Type
The GenericPreAmp is a dummy PreAmp model that accounts for effects such as decay and rise time, offset, noise and gain.
This dummy model involves no real electronics response, only gain.
This struct is currently mutable because in the case of noise modelling based on data, the gain has to match the one in the baselines extracted from data, so in that case the PreAmp is initialized with gain = 0, and the gain is calculated later. I assume this is temporary, as the user should know which gain / max_e the data was produced with and give it as simulation input.
LegendGeSim.GenericPreAmp — Method
GenericPreAmp(sim_conf)LegendGeSimConfig -> GenericPreAmp
Construct a GenericPreAmp instance based on given simulation configuration <sim_conf>
LegendGeSim.NoiseFromData — Type
The NoiseFromData model means instead of simulating given preamp noise, and also gain and offset, these parameters will be accounted for or inferred from real data baselines contained in the <baseline_catalog>
LegendGeSim.NoiseFromData — Method
NoiseFromData(sim_conf)LegendGeSimConfig -> NoiseFromData
Construct a NoiseFromData struct based on given simulation configuration <sim_conf>
LegendGeSim.NoiseFromSim — Type
The NoiseFromSim model means simulating noise from scratch starting from fano noise of the germanium crystal and ending with noise coming from electronics components.
LegendGeSim.NoiseModel — Type
The NoiseModel supertype corresponds to different methods of simulating noise coming from the electronics chain components.
It is not simply a string in the ElecChain struct because it must exist as a separate instance for the stp->pss step that is independent from the elec simulation, but has to know what type of noise model is used to deal with fano noise.
LegendGeSim.NoiseModel — Method
NoiseModel(sim_config)LegendGeSimConfig -> <NoiseModel>
Constuct a NoiseModel supertype instance based on simulation settings given in <simconfig> Type of <NoiseModel> depends on <simconfig> settings.
LegendGeSim.PSSimulator — Type
The PSSimulator supertype defines what type of method is used for the simulation of electric field and weighting potential, calculation of detector capacitance etc., as well as simulation of current pulses
LegendGeSim.PreAmp — Type
The PreAmp supertype corresponds to the charge sensitive preamplifier component
LegendGeSim.PreAmp — Method
PreAmp(sim_conf)LegendGeSimConfig -> <PreAmp>
Construct a PreAmp supertype instance based on given simulation configuration <simconf>. Returned type depends on the settings in <simconf>. Currently only GenericPreAmp is available.
LegendGeSim.SSDSimulator — Type
Simulation method: SolidStateDetectors
LegendGeSim.SiggenSimulator — Type
SSDSimulator(sim_conf)LegendGeSimConfig -> SSDSimulator
Construct SSDSimulator instance based on simulation configuration given in <sim_conf>.
Currently SSDSimulator does not have any parameters
LegendGeSim.Struck — Type
FADC with Struck algorithm (ToDo)
LegendGeSim.TrapFilter — Type
The TrapFilter trigger is a dummy simulation of the trapezoidal filter algorithm to produce a trigger if the waveform amplitude passes a certain threshold.
This struct is currently mutable because in case of NoiseFromData modelling, we need to calculate the threshold post-factum after analysing the noise levels in data.
LegendGeSim.TrapFilter — Method
TrapFilter(sim_conf)LegendGeSimConfig -> TrapFilter
Construct a TrapFilter instance based on simulation configuration given in <sim_conf>.
LegendGeSim.Trigger — Type
The Trigger supertype corresponds to the trigger component in DAQ.
LegendGeSim.Trigger — Method
Trigger(sim_conf)LegendGeSimConfig -> <Trigger>
Construct a Trigger supertype instance based on settings given in <sim_conf>. The returned type depends on the given settings.
Currently only TrapFilter type is implemented.
LegendGeSim.add_tail_and_baseline — Method
add_tail_and_baseline(wf, fadc, daq)RDWaveform, GenericFADC, GenericDAQ -> RDWaveform
Extend tail and add baseline of <wf> based on <fadc> and <daq> parameters.
Extended conservatively to ensure enough samples for the future sliding trap filter window and the resulting DAQ baseline.
LegendGeSim.baseline_catalog — Method
baseline_catalog(raw_filename)AbstractString -> Table
Look up stored table of baselines corresponding to given raw data <raw_filename>. If does not exist, construct such table.
LegendGeSim.baseline_catalog — Method
baseline_catalog(raw_table)Table -> Table
Construct table of baselines extracted from the waveforms contained in the given raw data table <raw_table>
LegendGeSim.construct_ssd_simulation — Method
construct_ssd_simulation(det_meta, env, sim_settings)PropDict, Environment, SSDSimulator -> SSD.Simulation
Construct a SolidStateDetectors.Simulation based on geometry as given in LEGEND metadata det_meta and on envorinmental settings specified in env and on simulational settings specified in sim_settings.
LegendGeSim.differentiate — Method
differentiate(wf)RDWaveform -> RDWaveform
Differentiate a waveform using a Biquad filter
LegendGeSim.extend_baseline — Method
extend_baseline(baseline, wf)RDWaveform, RDWaveform -> RDWaveform
Take a given <baseline> and extend it to match the length (and sampling) of the given waveform <wf>
LegendGeSim.fano_noise — Method
fano_noise(events, ::PropDict, ::Environment, ::NoiseFromData)Table -> Table
Do nothing since we do not need to simulate fano noise separately when using data baselines to account for noise levels.
LegendGeSim.fano_noise — Method
fano_noise(events, det_meta, env, ::NoiseFromSim)Table, PropDict, Environment -> Table
Calculate fano noise level based on the detector specification provided in LEGEND metadata <det_meta> and environment settings provided in <env>, and add it to given <events>
LegendGeSim.filename — Method
filename(path)Sring -> String
Extract core name of the file from path
E.g. filename("/some/path/to/filename.ext") -> "filename"
LegendGeSim.group_by_column — Method
group_by_column(table, colname)TypedTables.Table, Symbol -> TypedTables.Table
Group table <table> by given column <colname>.
I think this function already exists somewhere. Gotta ask Oliver and maybe use that package instead.
LegendGeSim.impurity_density_model — Method
Convert fit parameters from crystal metadata units (1e9 e/cm^3 VS mm) into SSD units (e/m^3 VS m) and return SolidStateDetector impurity density type RadfordImpurityDensity to be later used when constructing SSD object.
LegendGeSim.impurity_density_model — Method
impurity_density_model(crystal_metadata)PropDict -> Vector{Float64}
Fit the impurity measurements in the crystal metadata with David Radford's empirical function a + bz + cexp((z-L)/tau) where z is crystal coordinate from seed end (z=0) to crystal length(z=L)
The fit is performed in crystal metadata coordinates i.e. distance in mm and impurity values in 1e9 e/cm^3 which determines the units of the parameters a,b,c,tau returned in the vector of Float32.
LegendGeSim.pet_to_raw — Method
pet_to_raw(pet_file_path, sim_config, config_name)AbstractString, PropDict, AbstractString -> Table
[WIP] Full simulation chain pet->stp->pss->raw based on simulated energy depositions contained in the HDF5 file found in <petfilepath> and simulation settings given in <sim_config>.
The output name <config_name> is used to construct filenames for cached simulation files (currently the same as the simulation config basename)
LegendGeSim.pet_to_stp — Method
pet_to_stp(pet_table, detector_SSD)
Table, SolidStateDetectors.Simulation -> TableConstruct a table with "stepping info" based on position-energy-time information of simulated energy depositions given in <pettable> and detector geometry given in <detectorSSD>.
Current steps include: - removing events outside of detector PV - clustering - grouping by detector - removing events reconstructed to be outisde of the detector
LegendGeSim.preamp_gain — Method
preamp_gain(preamp, ::NoiseFromSim)GenericPreAmp -> Float64
Do nothing and return original value of gain parameter in <preamp>, since when NoiseFromSim model is used, gain is provided by the user (or calculated based on user given max energy)
LegendGeSim.preamp_gain — Method
preamp_gain(preamp, noise_model)GenericPreAmp, NoiseFromData -> Real
Calculate gain of <preamp> based on its max energy and the offset observed in data baselines contained in <noise_model>
In principle we should not do this in this simulation, and user has to provide the precise parameters of the electronics chain used in producing data the baselines from which are contained in <noise_model>.
LegendGeSim.process_waveforms — Method
process_waveforms(pss_table, elec_chain, trigger, daq, noise_model)Table, GenericElecChain, Trigger, DAQ, NoiseModel -> Table
Simulate effects of the electronics chain <elecchain>, <trigger> and <daq> settings on the waveforms contained in <psstable>. Noise is simulated based on the given <noise_model>. The output table contains the resulting DAQ waveforms, simulated online energy after tigger, baselines and their RMS, needed for the raw tier table.
LegendGeSim.pss_to_raw — Method
pss_to_raw(pss_table, pss_truth, simulation_settings, elec_chain, trigger, daq, noise_model)Table, Table, SSDSimulator, ElecChain, Trigger, DAQ, NoiseModel -> Table
Simulate effects of the electronics chain <elecchain>, <trigger> and <daq> settings on the waveforms contained in <psstable>. Noise is simulated based on the given <noisemodel>. Construct a table with the format identical to data raw tier. Currently timing information in <psstruth> is used for dummy timestamps in the output raw tier table.
LegendGeSim.read_pet — Method
AbstractString -> Table
LegendGeSim.remove_negative — Method
remove_negative(value)Real -> Real
Replace negative values by zeros.
Used to remove a glitch in SSD pulses as a quick fix while the glitch is being debugged.
LegendGeSim.simulate — Method
simulate(wf, elec_chain, ::NoiseFromSim)RDWaveform, ElecChain -> RDWaveform
Simulate effects of the electronics chain on the waveform modelling noise based on each component.
LegendGeSim.simulate — Method
simulate(wf, elec_chain)RDWaveform, ElecChain -> RDWaveform
Simulate effects of the electronics chain components on the waveform.
LegendGeSim.simulate — Method
simulate(wf, elec_chain, noise_model)RDWaveform, GenericElecChain, NoiseFromData -> RDWaveform
Simulate effects of the electronics chain on the waveform modelling noise based on baselines extracted from data (note: also takes preamp offset into account)
LegendGeSim.simulate — Method
simulate(wf, fadc)RDWaveform, GenericFADC -> RDWaveform
Simulate effects of FADC module <fadc> on the waveform <wf> (sampling and digitization)
LegendGeSim.simulate — Method
simulate(wf, preamp)RDWaveform, GenericPreAmp -> RDWaveform
Simulate the effecs of the preamp on the waveform.
LegendGeSim.simulate — Method
simulate(wf, trap_filter)RDWaveform, TrapFilter -> Int, Real
Simulate the results of applying <trapfilter> to <wf> Returns the index on which <wf> triggered, and the estimated online energy based on <trapfilter> output.
LegendGeSim.simulate — Method
simulate(wf, trigger_index, daq)RDWaveform, Int, DAQ -> RDWaveform
Simulate how the DAQ stores the waveform after it receives a trigger.
LegendGeSim.simulate_noise — Method
simulate_noise(wf, noise_model)RDWaveform, NoiseFromData -> RDWaveform
Simulate noise and offset by picking a random baseline from the baseline catalog contained in <noise_model> and slapping it on top of the given waveform <wf>.
LegendGeSim.simulate_noise — Method
simulate_noise(wf, preamp)RDWaveform, PreAmp -> RDWaveform
Simulate effects of the preamplifier <preamp> on the given waveform <wf>.
LegendGeSim.simulate_waveforms — Method
simulate_waveforms(stp_events, detector)Table, SolidStateDetectors.Simulation -> Table, Table
Simulate pulses based on events given in <stp_events> using the given SSD detector simulation instance <detector>
Constructs and returns a table with resulting pulses and a pss truth table (may be abolished in the future as unnecessary)
LegendGeSim.stp_to_pss — Method
stp_to_pss(stp_table, det_meta, env, ps_simulator, config_name)Table, PropDict, Env, PSSimulator, NoiseModel, AbstractString -> Table, Table
- NOTE * Lukas removed NoiseModel from here for some reason (search for fano_noise in old files)
Simulate waveforms based on stepping info given in <stptable>, LEGEND detector metadata <detmeta>, environment settings given in <env>, pulse shape simulation method <pssimulator>, and <noisemodel>
The output is a table with simulated pulses, and a table with simulation truth (may be abolished in the future since basically corresponds to stp table)
LegendGeSim.trigger_threshold — Method
trigger_threshold(trigger, preamp, noise_model)Trigger, GenericPreAmp, NoiseFromData -> Real
In NoiseFromData setting, if trigger threshold in keV is not provided, it is calculated based on noise levels in the baselines contained in <noise_model>. Otherwise the final threshold is calculated based on <preamp> gain.
LegendGeSim.trigger_threshold — Method
trigger_threshold(trigger, preamp, ::NoiseFromSim)Trigger, GenericPreAmp -> Real
In NoiseFromSim setting, non-zero trigger threshold in keV MUST be given by the user. Calculate final threshold based the value contained in <trigger>, and <preamp> gain.