Skip to content

Commit 9ed57fe

Browse files
Fix some loop bonuds
1 parent 110b143 commit 9ed57fe

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

sbncode/CAFMaker/FillTrue.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ namespace caf {
465465

466466
srneutrino.index = i;
467467

468-
for (int c = 0; c < 2; c++) {
468+
for (int c = 0; c < (int)active_volumes.size(); c++) {
469469
SRTrueInteractionPlaneInfo init;
470470
init.visE = 0.;
471471
init.nhit = 0;
@@ -483,7 +483,7 @@ namespace caf {
483483

484484
// total up the deposited energy
485485
for(int p = 0; p < 3; ++p) {
486-
for (int i_cryo = 0; i_cryo < 2; i_cryo++) {
486+
for (int i_cryo = 0; i_cryo < (int)active_volumes.size(); i_cryo++) {
487487
srneutrino.plane[i_cryo][p].visE += part.plane[i_cryo][p].visE;
488488
}
489489
}
@@ -493,7 +493,7 @@ namespace caf {
493493

494494
// Set of hits per-plane: primary particles
495495
{
496-
std::vector<std::array<std::set<unsigned>, 3>> planehitIDs(2);
496+
std::vector<std::array<std::set<unsigned>, 3>> planehitIDs(active_volumes.size());
497497
for (unsigned i_part = 0; i_part < srparticles.size(); i_part++) {
498498
if (srparticles[i_part].start_process == caf::kG4primary && srparticles[i_part].interaction_id == (int)i) {
499499
int track_id = srparticles[i_part].G4ID;
@@ -507,15 +507,15 @@ namespace caf {
507507
}
508508

509509
for(int p = 0; p < 3; ++p) {
510-
for (int i_cryo = 0; i_cryo < 2; i_cryo++) {
510+
for (int i_cryo = 0; i_cryo < (int)active_volumes.size(); i_cryo++) {
511511
srneutrino.plane[i_cryo][p].nhitprim = planehitIDs[i_cryo][p].size();
512512
}
513513
}
514514
}
515515

516516
// Set of hits per-plane: all particles
517517
{
518-
std::vector<std::array<std::set<unsigned>, 3>> planehitIDs(2);
518+
std::vector<std::array<std::set<unsigned>, 3>> planehitIDs(active_volumes.size());
519519
for (unsigned i_part = 0; i_part < srparticles.size(); i_part++) {
520520
if (srparticles[i_part].interaction_id == (int)i) {
521521
int track_id = srparticles[i_part].G4ID;
@@ -529,7 +529,7 @@ namespace caf {
529529
}
530530

531531
for(int p = 0; p < 3; ++p) {
532-
for (int i_cryo = 0; i_cryo < 2; i_cryo++) {
532+
for (int i_cryo = 0; i_cryo < (int)active_volumes.size(); i_cryo++) {
533533
srneutrino.plane[i_cryo][p].nhit = planehitIDs[i_cryo][p].size();
534534
}
535535
}
@@ -599,7 +599,7 @@ namespace caf {
599599
}
600600

601601
// Set the cryostat of the position
602-
for (int icryo = 0; icryo < 2; icryo++) {
602+
for (int icryo = 0; icryo < (int)active_volumes.size(); icryo++) {
603603
if (active_volumes[icryo].ContainsPosition(nu.Nu().Position().Vect())) {
604604
srneutrino.cryostat = icryo;
605605
break;

0 commit comments

Comments
 (0)