API
Modules
Types and constants
LegendGeSim.CC4
LegendGeSim.DAQ
LegendGeSim.DAQ
LegendGeSim.ElecChain
LegendGeSim.ElecChain
LegendGeSim.Environment
LegendGeSim.FADC
LegendGeSim.FADC
LegendGeSim.Flashcam
LegendGeSim.GenericDAQ
LegendGeSim.GenericDAQ
LegendGeSim.GenericElecChain
LegendGeSim.GenericElecChain
LegendGeSim.GenericFADC
LegendGeSim.GenericFADC
LegendGeSim.GenericPreAmp
LegendGeSim.GenericPreAmp
LegendGeSim.NoiseFromData
LegendGeSim.NoiseFromData
LegendGeSim.NoiseFromSim
LegendGeSim.NoiseModel
LegendGeSim.NoiseModel
LegendGeSim.PSSimulator
LegendGeSim.PreAmp
LegendGeSim.PreAmp
LegendGeSim.SSDSimulator
LegendGeSim.SiggenSimulator
LegendGeSim.Struck
LegendGeSim.TrapFilter
LegendGeSim.TrapFilter
LegendGeSim.Trigger
LegendGeSim.Trigger
Functions and macros
LegendGeSim.add_tail_and_baseline
LegendGeSim.baseline_catalog
LegendGeSim.baseline_catalog
LegendGeSim.construct_ssd_simulation
LegendGeSim.differentiate
LegendGeSim.extend_baseline
LegendGeSim.fano_noise
LegendGeSim.fano_noise
LegendGeSim.filename
LegendGeSim.group_by_column
LegendGeSim.impurity_density_model
LegendGeSim.impurity_density_model
LegendGeSim.pet_to_raw
LegendGeSim.pet_to_stp
LegendGeSim.preamp_gain
LegendGeSim.preamp_gain
LegendGeSim.process_waveforms
LegendGeSim.pss_to_raw
LegendGeSim.read_pet
LegendGeSim.remove_negative
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate
LegendGeSim.simulate_noise
LegendGeSim.simulate_noise
LegendGeSim.simulate_waveforms
LegendGeSim.stp_to_pss
LegendGeSim.trigger_threshold
LegendGeSim.trigger_threshold
Documentation
LegendGeSim.LegendGeSim
— ModuleLegendGeSim
Template for Julia packages.
LegendGeSim.CC4
— TypeCC4 circuit model (ToDo)
LegendGeSim.DAQ
— TypeThe DAQ supertype corresponds to the component of the DAQ and electronics setup that saves the waveform after it triggered
LegendGeSim.DAQ
— MethodDAQ(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
— TypeThe ElecChain supertype corresponds to the chain of electronic components involved in the DAQ setup that appear before the trigger.
LegendGeSim.ElecChain
— MethodElecChain(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
— MethodSimulation parameters related to the environment
LegendGeSim.FADC
— TypeThe FADC supertype corresponds to the FADC component of the electronics chain in the DAQ setup.
LegendGeSim.FADC
— MethodFADC(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
— TypeFADC with Flashcam algorithm (ToDo)
LegendGeSim.GenericDAQ
— TypeGenericDAQ 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
— MethodGenericDAQ(sim_conf)
LegendGeSimConfig -> GenericDAQ
Construct a GenericDAQ struct based on given simulation configuration
LegendGeSim.GenericElecChain
— TypeGeneric electronics chain consisting of a preamplifier and an FADC module
LegendGeSim.GenericElecChain
— MethodGenericElecChain(sim_conf)
LegendGeSimConfig -> GenericElecChain
Construct electronics components based on simulation configuration <sim_conf> and create a GenericChain instance based on these components.
LegendGeSim.GenericFADC
— TypeGenericFADC is a dummy FADC model that performs sampling of the input waveform based on the sampling interval <Δt>
LegendGeSim.GenericFADC
— MethodGenericFADC(sim_conf)
LegendGeSimConfig -> GenericFADC
Construct a GenericFADC instance based on simulation configuration <sim_conf>
LegendGeSim.GenericPreAmp
— TypeThe 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
— MethodGenericPreAmp(sim_conf)
LegendGeSimConfig -> GenericPreAmp
Construct a GenericPreAmp instance based on given simulation configuration <sim_conf>
LegendGeSim.NoiseFromData
— TypeThe 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
— MethodNoiseFromData(sim_conf)
LegendGeSimConfig -> NoiseFromData
Construct a NoiseFromData struct based on given simulation configuration <sim_conf>
LegendGeSim.NoiseFromSim
— TypeThe 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
— TypeThe 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
— MethodNoiseModel(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
— TypeThe 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
— TypeThe PreAmp supertype corresponds to the charge sensitive preamplifier component
LegendGeSim.PreAmp
— MethodPreAmp(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
— TypeSimulation method: SolidStateDetectors
LegendGeSim.SiggenSimulator
— TypeSSDSimulator(sim_conf)
LegendGeSimConfig -> SSDSimulator
Construct SSDSimulator instance based on simulation configuration given in <sim_conf>.
Currently SSDSimulator does not have any parameters
LegendGeSim.Struck
— TypeFADC with Struck algorithm (ToDo)
LegendGeSim.TrapFilter
— TypeThe 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
— MethodTrapFilter(sim_conf)
LegendGeSimConfig -> TrapFilter
Construct a TrapFilter instance based on simulation configuration given in <sim_conf>.
LegendGeSim.Trigger
— TypeThe Trigger supertype corresponds to the trigger component in DAQ.
LegendGeSim.Trigger
— MethodTrigger(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
— Methodadd_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
— Methodbaseline_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
— Methodbaseline_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
— Methodconstruct_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
— Methoddifferentiate(wf)
RDWaveform -> RDWaveform
Differentiate a waveform using a Biquad filter
LegendGeSim.extend_baseline
— Methodextend_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
— Methodfano_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
— Methodfano_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
— Methodfilename(path)
Sring -> String
Extract core name of the file from path
E.g. filename("/some/path/to/filename.ext") -> "filename"
LegendGeSim.group_by_column
— Methodgroup_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
— MethodConvert 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
— Methodimpurity_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
— Methodpet_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
— Methodpet_to_stp(pet_table, detector_SSD)
Table, SolidStateDetectors.Simulation -> Table
Construct 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
— Methodpreamp_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
— Methodpreamp_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
— Methodprocess_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
— Methodpss_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
— MethodAbstractString -> Table
LegendGeSim.remove_negative
— Methodremove_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
— Methodsimulate(wf, elec_chain, ::NoiseFromSim)
RDWaveform, ElecChain -> RDWaveform
Simulate effects of the electronics chain on the waveform modelling noise based on each component.
LegendGeSim.simulate
— Methodsimulate(wf, elec_chain)
RDWaveform, ElecChain -> RDWaveform
Simulate effects of the electronics chain components on the waveform.
LegendGeSim.simulate
— Methodsimulate(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
— Methodsimulate(wf, fadc)
RDWaveform, GenericFADC -> RDWaveform
Simulate effects of FADC module <fadc> on the waveform <wf> (sampling and digitization)
LegendGeSim.simulate
— Methodsimulate(wf, preamp)
RDWaveform, GenericPreAmp -> RDWaveform
Simulate the effecs of the preamp on the waveform.
LegendGeSim.simulate
— Methodsimulate(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
— Methodsimulate(wf, trigger_index, daq)
RDWaveform, Int, DAQ -> RDWaveform
Simulate how the DAQ stores the waveform after it receives a trigger.
LegendGeSim.simulate_noise
— Methodsimulate_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
— Methodsimulate_noise(wf, preamp)
RDWaveform, PreAmp -> RDWaveform
Simulate effects of the preamplifier <preamp> on the given waveform <wf>.
LegendGeSim.simulate_waveforms
— Methodsimulate_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
— Methodstp_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
— Methodtrigger_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
— Methodtrigger_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.