Skip to content
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sbnana/CAFAna/Core/SpectrumLoader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ namespace ana
if(!sr->hdr.ismc){
const int nbnb = sr->hdr.bnbinfo.size();
const int nnumi = sr->hdr.numiinfo.size();
if(nbnb > 0 && nnumi > 0){
std::cout << "SpectrumLoader: nonzero number of both BNB (" << nbnb
<< ") and NuMI (" << nnumi << ") triggers. I'm confused"
const int next = sr->hdr.extinfo.size();
if(nbnb > 0 && nnumi > 0 && next > 0){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this abort when all three are non-zero or just when two out of three are?

std::cout << "SpectrumLoader: nonzero number of BNB (" << nbnb
<< "), NuMI (" << nnumi << "), and EXT (" << next << ") triggers. I'm confused"
Comment on lines +191 to +193

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

More maintainable alternative:

Suggested change
if((nbnb > 0 && nnumi > 0) || (nbnb > 0 && next > 0) || (nnumi > 0 && next > 0)){
std::cout << "SpectrumLoader: nonzero number of 2 of 3 BNB (" << nbnb
<< "), NuMI (" << nnumi << "), and EXT (" << next << ") triggers. I'm confused"
const unsigned int nGateTypes = (nbnb > 0) + (nnumi > 0) + (next > 0);
if(nGateTypes > 1){
std::cout << "SpectrumLoader: nonzero number of " << nGateTypes << " of 3 BNB (" << nbnb
<< "), NuMI (" << nnumi << "), and EXT (" << next << ") triggers. I'm confused"

<< std::endl;
abort();
}

fNReadouts += nbnb + nnumi;
fNReadouts += nbnb + nnumi + next;
}

// This record was only kept as a receptacle for exposure information. It
Expand Down