Allow for different thresholds for OpHitFinder#36
Allow for different thresholds for OpHitFinder#36asanchezcastillo wants to merge 7 commits intoLArSoft:developfrom
Conversation
|
A new Pull Request was created by @asanchezcastillo (Alejandro Sánchez Castillo) for develop. It involves the following packages: larana @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
|
The code-checks are being triggered in jenkins. |
|
-code-checks Then commit the changes and push them to your PR branch. |
|
Pull request #36 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again. |
|
The code-checks are being triggered in jenkins. |
|
+code-checks |
|
@asanchezcastillo, do you intend this PR to be in draft state? |
|
@knoepfel I am marking it as ready for review now. Thanks for asking. |
|
trigger build |
|
The tests are being triggered in jenkins. |
|
+LArSoft tests OK on slf7 for c14:prof |
|
-DUNE tests failed on slf7 for e26:prof |
absolution1
left a comment
There was a problem hiding this comment.
Thank you for the PR. I've added a set of comments about removing the default fcl values.
| _peak_thresh_by_channel = pset.get<bool>("ThreshByChannel", false); | ||
| _peak_thresh_vector = pset.get<std::vector<double>>("PeakThreshVector", {}); |
There was a problem hiding this comment.
It looks like this module is not using fcl validation, so default fcl values should be avoided. Could these be removed from the producer, and then add the parameters to the default fcl?
There was a problem hiding this comment.
We suggest a different approach. It looks like two configuration parameters are being used: one that says "use the threshold-by-channel option", and another that says "here are the thresholds by channel". Instead of using two parameters, it is better to use one optional parameter. For example, make this change:
- //Whether to apply an individual threshold for each channel
- bool _peak_thresh_by_channel;
- //Vector of thresholds for each channel
- std::vector<double> _peak_thresh_vector;
+ //Optional user-specified vector of thresholds for each channel
+ std::optional<std::vector<double>> _peak_thresh_vector;You would then switch to:
_peak_thresh_vector = pset.get_if_present<std::vector<double>>("PeakThreshVector");If _peak_thresh_vector is "engaged" (i.e. there's a value associated with it), then "PeakThreshVector" has been specified in the configuration. If it is not engaged, then there is no configuration parameter present. The check would then look something like:
if (_peak_thresh_vector) {
uint ChannelNumber = wf.ChannelNumber();
if (ChannelNumber >= _peak_thresh_vector->size())
throw cet::exception("OpHitFinder")
<< "Threshold not found for channel " << ChannelNumber << "\n";
_peak_thresh = (*_peak_thresh_vector)[ChannelNumber];
}| : PMTPulseRecoBase(name) | ||
| { | ||
|
|
||
| _adc_thres_by_channel = pset.get<bool>("ADCThresholdByChannel", false); |
| { | ||
|
|
||
| _adc_thres_by_channel = pset.get<bool>("ADCThresholdByChannel", false); | ||
| _adc_thres_vector = pset.get<std::vector<float>>("ADCThresVector", {}); |
| _adc_thres_by_channel = pset.get<bool>("ADCThresholdByChannel", false); | ||
|
|
||
| _adc_thres_vector = pset.get<std::vector<float>>("ADCThresVector", {}); | ||
|
|
|
Pull request #36 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again. |
|
The code-checks are being triggered in jenkins. |
|
+code-checks |
knoepfel
left a comment
There was a problem hiding this comment.
@asanchezcastillo, thanks for this PR. The switch from Waveform_t to OpDetWaveform is appropriate. See the comment below regarding configuration. Instead of doing everything with two parameters (which introduces an awkwardness for the user), we suggest doing it with one where no defaults are required.
| _peak_thresh_by_channel = pset.get<bool>("ThreshByChannel", false); | ||
| _peak_thresh_vector = pset.get<std::vector<double>>("PeakThreshVector", {}); |
There was a problem hiding this comment.
We suggest a different approach. It looks like two configuration parameters are being used: one that says "use the threshold-by-channel option", and another that says "here are the thresholds by channel". Instead of using two parameters, it is better to use one optional parameter. For example, make this change:
- //Whether to apply an individual threshold for each channel
- bool _peak_thresh_by_channel;
- //Vector of thresholds for each channel
- std::vector<double> _peak_thresh_vector;
+ //Optional user-specified vector of thresholds for each channel
+ std::optional<std::vector<double>> _peak_thresh_vector;You would then switch to:
_peak_thresh_vector = pset.get_if_present<std::vector<double>>("PeakThreshVector");If _peak_thresh_vector is "engaged" (i.e. there's a value associated with it), then "PeakThreshVector" has been specified in the configuration. If it is not engaged, then there is no configuration parameter present. The check would then look something like:
if (_peak_thresh_vector) {
uint ChannelNumber = wf.ChannelNumber();
if (ChannelNumber >= _peak_thresh_vector->size())
throw cet::exception("OpHitFinder")
<< "Threshold not found for channel " << ChannelNumber << "\n";
_peak_thresh = (*_peak_thresh_vector)[ChannelNumber];
}|
@asanchezcastillo, are you able to implement the suggested changes above? |
Update to larana v10_00_09
|
Pull request #36 was updated. @LArSoft/level-1-managers, @LArSoft/level-2-managers can you please check and sign again. |
|
The code-checks are being triggered in jenkins. |
|
+code-checks |
|
Hi @knoepfel. There was a build issue with duneopdet that we are currently tying to fix. I do not think it will take long though, so when we are done I will incorporate the changes into the PR. Thanks! |
|
@asanchezcastillo Do you have time to update this PR now? |
|
@asanchezcastillo, we have converted this PR to a draft until DUNE/duneopdet#83 is ready. |
SBND optical reconstruction requires using individual threshold for each channel. This PR incorporates the required changes which are summarized below:
RunHitFindertakes araw:OpDetWaveformthis is later converted to apmtana::Waveform_ton theReconstructmethod ofPulseRecoManagerlosing the required information about the channel number. The same happens for theReconstructmethod ofPMTPulseRecoBaseand theRecoPulsemethod implemented by the reconstruction algorithm. Fortunately enough, bothpmtana::Waveform_tandraw::OpDetWaveforminherit fromstd::vector<>which to the best of my knowledge makes backwards compatibility given just by changing the object we pass into the former methods.