Skip to content

Add new AddGroupNoise module#154

Merged
brettviren merged 6 commits intoWireCell:masterfrom
rennney:master
Apr 5, 2022
Merged

Add new AddGroupNoise module#154
brettviren merged 6 commits intoWireCell:masterfrom
rennney:master

Conversation

@rennney
Copy link

@rennney rennney commented Mar 14, 2022

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

Sergey Martynenko added 2 commits March 14, 2022 09:50
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
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable does not seem to be used. And so gen_elec_resp_default() and m_fft_length are unnecessary.

Comment on lines 47 to 49
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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many places here and in the .cxx where indentation is not consistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be helpful in formatting the code:
https://hackmd.io/@wire-cell-tutorial/index/%2FhRMsXxbvQRuumDKX_abG9g

std::unordered_map<int,std::vector<float>> m_grp2rnd_phs;
Waveform::realseq_t m_elec_resp_freq;

Log::logptr_t log;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used, remove.

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, the phase should be chosen once per group and per event.

Sergey Martynenko added 4 commits March 21, 2022 14:58
Address requested changes
Include IDFT support
Properly provide spectrum for IDFT
Add scaling factor for the input spectrums
Remove unusde variable
@rennney rennney requested a review from brettviren April 4, 2022 23:12
Copy link
Member

@brettviren brettviren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some speed optimizations that can be done but that can be left for later if it is a problem.

@brettviren brettviren merged commit 8bc9f1e into WireCell:master Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants