Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@marc1uk
Copy link

@marc1uk marc1uk commented Oct 22, 2018

Loops in WCSimWCTrigger::AlgNDigits and WCSimWCTrigger::FillDigitsCollection now use an iterator to loop over the times map and retrieve the keys present.
In WCSimWCDigi.hh several uses of the operator[] were replaced with map::at.
fDigiComp was removed from the sort in WCSimWCDigi::SortArrayByHitTime as this has no entries at the time when it is called (so switching use to fDigiComp.at() produces an exception).
#245

…Digits loop over times from a for loop to an iterator loop. This should support stacked triggers where some keys may be removed.
void SortHitTimes() { sort(time_float.begin(),time_float.end()); }


void SortArrayByHitTime() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that where SortArrayByHitTime() is called currently, we don't need to sort fDigiComp. But maybe we want to future proof ourselves for potentially using this sorting method elsewhere in the future by keeping it in. And maybe making the method name more descriptive such as:

Suggested change
void SortArrayByHitTime() {
void SortAllMapsByHitTime() {

Alternatively, we could do as you suggest and get rid of fDigiComp sorting here, and rename to

Suggested change
void SortArrayByHitTime() {
void SortMapsByHitTimeForDigitizer() {

void SortHitTimes() { sort(time_float.begin(),time_float.end()); }


void SortArrayByHitTime() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that where SortArrayByHitTime() is called currently, we don't need to sort fDigiComp. But maybe we want to future proof ourselves for potentially using this sorting method elsewhere in the future by keeping it in. And maybe making the method name more descriptive such as:

Suggested change
void SortArrayByHitTime() {
void SortAllMapsByHitTime() {

Alternatively, we could do as you suggest and get rid of fDigiComp sorting here, and rename to

Suggested change
void SortArrayByHitTime() {
void SortMapsByHitTimeForDigitizer() {

catch (...) {
G4cerr<<"Exception occurred while attempting to use WCSimWCDigi::GetTime to retrieve time for pe "
<< gate << " from map of times. The time map has "<<time.size()<<" entries:" << G4endl;
for (auto& x: time){
Copy link
Contributor

Choose a reason for hiding this comment

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

@eosullivan can comment, but I'm not sure WCSim is using C++11 yet

catch (...) {
G4cerr<<"Exception occurred while attempting to use WCSimWCDigi::GetTime to retrieve time for pe "
<< gate << " from map of times. The time map has "<<time.size()<<" entries:" << G4endl;
for (auto& x: time){
Copy link
Contributor

Choose a reason for hiding this comment

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

@eosullivan can comment, but I'm not sure WCSim is using C++11 yet

@tdealtry
Copy link
Contributor

The Travis build hasn't started for this. Any ideas @brichards64 or @eosullivan?

…f WCSimWCDigi::SortArraysByHitTime to WCSimWCDigi::SortDigiMapsByHitTime, and re-enable sorting of digi composition provided it is populated.
@marc1uk
Copy link
Author

marc1uk commented Oct 22, 2018

Thanks for the feedback. Pushed a new commit to remove c++11 and re-enable sorting of the fDigiComp map, provided its size is the same as the other maps.

@tdealtry
Copy link
Contributor

Great! Thanks for this @marc1uk!

@tdealtry tdealtry changed the title Fix for issue 245, support removal of digits in NDigits2 trigger. Fix for issue #245, support removal of digits in NDigits2 trigger. Apr 14, 2021
@tdealtry tdealtry added the bug label Apr 14, 2021
@tdealtry tdealtry merged commit 2a6baa4 into WCSim:develop Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants