Add new AddGroupNoise module#154
Conversation
Adding new module to add noise by groups with input map and spectrums. Also change configurations to incorporate the model Extra adjustments to bring current cfg files up-to-speed with icarus: 1)Change labels in simulation to TPCEE,TPCEW,TPCWE,TPCWW 2)Change position of chathode/anode by the absolute value of 10 (proposed change to fix space charge) 3)Change ADC to mV converion in signal processing 4)Change gain for elec. resp.
Comment out old coherent noise model, since files are not in wire-cell-data
gen/inc/WireCellGen/AddGroupNoise.h
Outdated
| std::unordered_map<int,std::vector<float>> m_grp2spec; | ||
| std::unordered_map<int,std::vector<float>> m_grp2rnd_amp; | ||
| std::unordered_map<int,std::vector<float>> m_grp2rnd_phs; | ||
| Waveform::realseq_t m_elec_resp_freq; |
There was a problem hiding this comment.
This variable does not seem to be used. And so gen_elec_resp_default() and m_fft_length are unnecessary.
gen/inc/WireCellGen/AddGroupNoise.h
Outdated
| std::unordered_map<int,int> m_ch2grp; | ||
| std::unordered_map<int,std::vector<float>> m_grp2spec; | ||
| std::unordered_map<int,std::vector<float>> m_grp2rnd_amp; |
There was a problem hiding this comment.
Many places here and in the .cxx where indentation is not consistent.
There was a problem hiding this comment.
This may be helpful in formatting the code:
https://hackmd.io/@wire-cell-tutorial/index/%2FhRMsXxbvQRuumDKX_abG9g
gen/inc/WireCellGen/AddGroupNoise.h
Outdated
| std::unordered_map<int,std::vector<float>> m_grp2rnd_phs; | ||
| Waveform::realseq_t m_elec_resp_freq; | ||
|
|
||
| Log::logptr_t log; |
gen/src/AddGroupNoise.cxx
Outdated
| std::vector<float> rnd_amp(spec_freq.size()); | ||
| for(unsigned int j=0;j<spec.size();++j){ | ||
| spec[j]=spec_amps[j].asFloat(); | ||
| rnd_amp[j] = m_shift + 2 * m_fluctuation * m_rng->uniform(0, 1); |
There was a problem hiding this comment.
Randomness should not be applied once in configure() but once per group in operator(). Also, sampling complex amplitude is a Rayleigh distribution (it samples a radius).
gen/src/AddGroupNoise.cxx
Outdated
| for(unsigned int j=0;j<spec.size();++j){ | ||
| spec[j]=spec_amps[j].asFloat(); | ||
| rnd_amp[j] = m_shift + 2 * m_fluctuation * m_rng->uniform(0, 1); | ||
| rnd_phs[j] = m_rng->uniform(0, 2 * M_PI); |
There was a problem hiding this comment.
Likewise, the phase should be chosen once per group and per event.
Address requested changes
Include IDFT support
Properly provide spectrum for IDFT Add scaling factor for the input spectrums
Remove unusde variable
brettviren
left a comment
There was a problem hiding this comment.
There are some speed optimizations that can be done but that can be left for later if it is a problem.
Adding new module to add noise by groups with input map and spectrums.
Also change configurations to incorporate the model
Extra adjustments to bring current cfg files up-to-speed with icarus:
1)Change labels in simulation to TPCEE,TPCEW,TPCWE,TPCWW
2)Change position of cathode/anode by the absolute value of 10 (proposed change to fix space charge)
3)Change gain/shaping for elec. response
4)Change ADC to mV conversion in signal processing