-
Notifications
You must be signed in to change notification settings - Fork 15
Dynamic NFOUR option and clean up several classes #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MyoungchulK
wants to merge
21
commits into
master
Choose a base branch
from
temp_d_nfour
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dear reviewers, This PR is not just including update, but also has a lots of code cleaning. It can be overwhelming (possibly frustrating) to check all of them. I try to explain most of them in this document but I realized document itself also become long. I will be really appreciate, if you spare little bit of patient for this PR (and for me). Thank you!:)
1. Dynamic NFOUR option.
After we generate an E-field WF and apply a detector response, we interpolate the signal with pre/user-defined time width (
TIMESTEP) and zero-pad the signal by also pre/user-defined pad length (NFOUR). Then, we moved on to the noise generation part and convolved them together.If the signal strength is enormous or the distance to the antenna cluster is too close, unfortunately, the pad length is too small to contain the entire signal. And signal WF from the root output has an unnatural or clipped shape. We traditionally set the pad length (
NFOUR) to be large (1024 to 2048) based on experience, but I found, It can still cause the clipped WF.In this update, I added the
DYNAMIC_NFOURoption in the Setting class. If theDYNAMIC_NFOURis set to1, the pad length will be automatically adjusted based on the original signal WF length. And prevent clipped WF. I must tell you thisDYNAMIC_NFOURoption is only implemented in the time-domain mode (SIMULATION_MODE = 1). If user select theDYNAMIC_NFOURmode without selecting time-domain mode, It will automatically use default NFOUR value.DYNAMIC_NFOURoption is placed just after sim apply detector response.new_NFOURwill set new zero-pad for signal WF (new_volts_forint,new_T_forint), and the interpolationed WF from sine interpolation will be stored in the zero-pad arrayDifferent NFOUR values set by each signal WF will be saved in Report branch.
While setting NFOUR, we save the longest/smallest NFOUR for placing signal into noise pad at later.
We use maximum NFOUR (
new_NFOUR_max) to prevent entire signal from being placed outside of the noise padAnd We use minimum NFOUR (
new_NFOUR_min) to allow the trigger scan to start the scan from the beginning of all the signals in the noise padThe maximum NFOUR (
new_NFOUR_max) will be used to set max_total_bin to contain the longest signal in noise padThe minimum NFOUR (
new_NFOUR_min) will be used to allow trigger scan to start the scan from the beginning of all the signals in the noise padBecause of different signal pad length for each solution, whether two ray solutions are connected or not will be identify by sum of half length of each pad
The signal + noise convolution part (
Select_Wave_Convlv_Exchange()1st func. 2nd func, 3rd func) is modified to accept the different NFOUR values.Since each signal WF length is different, we need to set the length of convolution pad by checking all the input signals length. We also need to consider the case that one of the signal range can cover other signals range. So, setting convolution pad like below is necessary.
At last, because of the possibility of dynamic convolution pad length, I decided to create new function in Detector class that re-padding diode values based on convolution pad length. If convolution pad is not the same as default NFOUR value, It will re-pad the diode value and transform to frequency spectrum. And the convolution functions will use that array.
2. clean up
I clean up the Detector, Trigger, and Report classes. Unfortunately, it was a bit hard to implement the Dynamic NFOUR without cleaning.
In the AraSim class, I delete two array. They are taking space and do nothing.
In the Detector class, I mainly removed arrays that have names, including
NFOUR.It is not used anymore, but somehow sim still generates the value, saves it in the below arrays, and does nothing.
Removed arrays in the header file
I also removed some script lines that related to the above lines. Below lines are example
I also added one more array and function in the detector class. When we start the simulation, we generate a diode response based on the
NOURlength. In this update, I propose a dynamicNOURoption, in which NFOUR length will be changed by signal length (especially 1st and 2nd connected signal). So, when we convolved the noise and signal, we needed to re-pad the diode too. Below function will take the diode response from the sim and will re-pad when the signal length is different than NFOUR length.Array in the header file
vector <double> fdiode_real_dynamic_databin;Function
In the Setting class, I added the option that control dynamic NFOUR option
Array in the header file
int DYNAMIC_NFOUR;in the
.ccfileIn the Trigger class, I removed several uncommented lines and the
myconvlv_half()andCheckChannelsPass()functions. It looks like we are not using it. But let me know if it has purposes.In the header file, I removed below arrays
in the
.ccfile, I removedmyconvlv_half()andCheckChannelsPass()functions and not used arraytwo myconvlv_half() functions
CheckChannelsPass() function
In the Report class, It looks like a lot. But I just removed all... unnecessary repetitive lines. Unfortunately, lots of identical lines are written in the code because It simply has different
ifconditions. And definitely, It can be shortened to a few lines. I only cleaned (removed repetitive lines) the time-domain signal generation part, triggering part, and readout window setting partIn the header file, I removed functions that loading not-used arrays in the detector class.
And I added
vector <int> New_NFOUR;array for storing dynamic NFOUR valuesin the .cc file,
First, I cleaned the signal generation part in time-domain mode (
SIMULATION_MODE == 1)Mainly, I just cleaned the comment and reorganized the codes.
is changed to below
is changed to below
All the effective height (Heff) lines are simply changed below. I organized values that can be changed by the if condition at the front
The long trigger scan part is changed to below. I organized values that can be changed by the if condition at the front. So there is no more repeated part. Trust me this is better than before.
Lastly I also reorganized readout window part (V_mimic). I organized values that can be changed by the if condition at the front.
terminal msg part is changed to below
V_mimic part is changed to below
Please let me know if you have a comment!