DUNE / larnd-sim

Simulation framework for a pixelated Liquid Argon TPC
Apache License 2.0
10 stars 26 forks source link

Light simulation issue 1: Noise #196

Open YifanC opened 5 months ago

YifanC commented 5 months ago

The simulation generates empty waveform for padding in order to produce light readout for all channels. Previously the padding waveforms look like this, because noise was not added. empty_light_wvfm_no_noise

Adding noise in such way produces empty waveforms with noise. However, you can notice the noise in the pre-trigger window is different, although they are not always different by eye in a single channel. empty_light_wvfm_separate_noise_all empty_light_wvfm_separate_noise_ch3

The way how light simulation in develop (71a493c) handles the signal and the noise is to join the pre-trigger, the "signal" and the post-signal and their noises (disjoint randomness). Especially the "signal" for thresholding and beam trigger are different. The pre-trigger part should always exist in the current scope, but the post-signal part may not be.

Here, I prepose to add noise only after padded signal is in shape. I think this should be an improvement in general. empty_light_wvfm_fixed_noise_all

Tag @mjkramer @krwood @liviocali @AWh1t3 for comments.

AWh1t3 commented 5 months ago

I agree that generating noise three separate times for one waveform is unnecessarily complicated, and it would make perfect sense to just add the noise overlay to the completed waveform once at the end!

AWh1t3 commented 5 months ago

The noise generating function is a reversed fast fourier transform. The noise files I've created are intended to be applied to a waveform with a very specific length and sample frequency. I think (I need to run a few trials to be sure) that the noise issues we've seen in terms of amplitude, at least, come from applying this function to a shorter sample, and potential issues with the code intended to allow that action. Thus, just generating noise for the final, fully-realized waveform would completely remove the potential for errors of this type.