Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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: 9 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,15 @@ namespace caf
false // default is false; set to true if you want SRHits filled
};

Atom<bool> FillUnassociatedHits {
Name("FillUnassociatedHits"),
Comment("If FillHits, also fill slice hits that have no PFParticle/SpacePoint "
"association, leaving spacepoint.pfpID = -1. Needed for second-shower and "
"isolation studies, which work from the hits Pandora left unclustered. "
"Increases the per-slice hit count substantially."),
false // default is false; preserves the historical FillHits behaviour
};

Atom<string> HitLabel {
Name("HitLabel"),
Comment("Base label of the TPC Hit producer."),
Expand Down
19 changes: 13 additions & 6 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2417,16 +2417,23 @@ void CAFMaker::produce(art::Event& evt) noexcept {
if (fmSpacePoint.isValid()) {
thisPoint = fmSpacePoint.at(iHit);
}
if (!thisParticle.empty() && !thisPoint.empty()) {
const bool associated = !thisParticle.empty() && !thisPoint.empty();
if (!associated && !fParams.FillUnassociatedHits()) continue;

rec.reco.nhit++;
rec.reco.hit.push_back(SRHit());

if (associated) {
assert(thisParticle.size() == 1);
assert(thisPoint.size() == 1);
rec.reco.nhit++;
rec.reco.hit.push_back(SRHit());

FillHitVars(thisHit, producer, *thisPoint[0], *thisParticle[0], rec.reco.hit.back());
recslc.reco.hit.push_back(rec.reco.hit.back());
recslc.reco.nhit = recslc.reco.hit.size();
}
else {
FillHitVars(thisHit, producer, rec.reco.hit.back());
}

recslc.reco.hit.push_back(rec.reco.hit.back());
recslc.reco.nhit = recslc.reco.hit.size();
}
}

Expand Down
16 changes: 14 additions & 2 deletions sbncode/CAFMaker/FillReco.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,6 @@ namespace caf

void FillHitVars(const recob::Hit& hit,
unsigned producer,
const recob::SpacePoint& spacepoint,
const recob::PFParticle& particle,
caf::SRHit& srhit,
bool allowEmpty)
{
Expand All @@ -1314,6 +1312,20 @@ namespace caf
srhit.tpcID = wire.TPC;
srhit.planeID = wire.Plane;
srhit.wireID = wire.Wire;

// setDefault() leaves spacepoint.pfpID and spacepoint.ID at -1, which is
// the "no PFP" state SRSpacePoint already documents.
}

void FillHitVars(const recob::Hit& hit,
unsigned producer,
const recob::SpacePoint& spacepoint,
const recob::PFParticle& particle,
caf::SRHit& srhit,
bool allowEmpty)
{
FillHitVars(hit, producer, srhit, allowEmpty);

srhit.spacepoint.XYZ = SRVector3D (spacepoint.XYZ());
srhit.spacepoint.chisq = spacepoint.Chisq();
srhit.spacepoint.pfpID = particle.Self();
Expand Down
5 changes: 5 additions & 0 deletions sbncode/CAFMaker/FillReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ namespace caf
caf::SRTrack& srtrk,
bool allowEmpty = false);

void FillHitVars(const recob::Hit& hit,
unsigned producer,
caf::SRHit& srhit,
bool allowEmpty = false);

void FillHitVars(const recob::Hit& hit,
unsigned producer,
const recob::SpacePoint& spacepoint,
Expand Down