Skip to content

Commit f46cc95

Browse files
authored
Merge pull request #608 from SBNSoftware/hotfix/hlay_shower_bestplane
Hotfix to Shower Best Plane Calorimetry
2 parents baaf88e + c55441a commit f46cc95

File tree

3 files changed

+53
-9
lines changed

3 files changed

+53
-9
lines changed

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2523,7 +2523,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25232523
assert(thisShower.size() == 1);
25242524

25252525
SRShower& shw = pfp.shw;
2526-
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw);
2526+
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw, fDet);
25272527

25282528
// We may have many residuals per shower depending on how many showers ar in the slice
25292529
if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {

sbncode/CAFMaker/FillReco.cxx

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ namespace caf
391391
const geo::WireReadoutGeom& wireReadout,
392392
unsigned producer,
393393
caf::SRShower &srshower,
394+
Det_t det,
394395
bool allowEmpty)
395396
{
396397

@@ -411,11 +412,56 @@ namespace caf
411412
// It's sth like this but not quite. And will need to pass a simb::MCtruth object vtx position anyway.
412413
// srshower.conversion_gap = (shower.ShowerStart() - vertex.Position()).Mag();
413414

414-
if(shower.best_plane() != -999){
415-
srshower.bestplane = shower.best_plane();
416-
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
417-
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
418-
}
415+
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
416+
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
417+
418+
if(det == kSBND)
419+
{
420+
int bestplane_for_energy = -999;
421+
int mosthits = -1;
422+
for(int p = 0; p < 3; ++p)
423+
{
424+
if((int)srshower.plane[p].nHits > mosthits)
425+
{
426+
mosthits = srshower.plane[p].nHits;
427+
bestplane_for_energy = p;
428+
}
429+
}
430+
431+
if(bestplane_for_energy != -999)
432+
{
433+
srshower.bestplane_for_energy = bestplane_for_energy;
434+
srshower.bestplane_energy = srshower.plane[bestplane_for_energy].energy;
435+
}
436+
437+
if(shower.best_plane() != -999 && srshower.plane[shower.best_plane()].dEdx != -999)
438+
{
439+
srshower.bestplane_for_dedx = shower.best_plane();
440+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
441+
}
442+
else
443+
{
444+
for(int p = 2; p >= 0; --p)
445+
{
446+
if(srshower.plane[p].dEdx != -999)
447+
{
448+
srshower.bestplane_for_dedx = p;
449+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
450+
break;
451+
}
452+
}
453+
}
454+
}
455+
else
456+
{
457+
if(shower.best_plane() != -999)
458+
{
459+
srshower.bestplane_for_energy = shower.best_plane();
460+
srshower.bestplane_for_dedx = shower.best_plane();
461+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
462+
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
463+
}
464+
}
419465

420466
if(shower.has_open_angle())
421467
srshower.open_angle = shower.OpenAngle();
@@ -438,9 +484,6 @@ namespace caf
438484
srshower.end = shower.ShowerStart()+ (shower.Length() * shower.Direction());
439485
}
440486

441-
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
442-
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
443-
444487
for (geo::PlaneGeo const& plane: wireReadout.Iterate<geo::PlaneGeo>()) {
445488

446489
const double angleToVert(wireReadout.WireAngleToVertical(plane.View(), plane.ID()) - 0.5*M_PI);

sbncode/CAFMaker/FillReco.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace caf
7070
const geo::WireReadoutGeom& wireReadout,
7171
unsigned producer,
7272
caf::SRShower& srshower,
73+
Det_t det,
7374
bool allowEmpty = false);
7475

7576
void FillShowerRazzle(const art::Ptr<sbn::MVAPID> razzle,

0 commit comments

Comments
 (0)