Skip to content
Merged
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
87 changes: 87 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace caf
template<class T> using Atom = fhicl::Atom<T>;
template<class T> using Sequence = fhicl::Sequence<T>;
template<class T> using Table = fhicl::Table<T>;
template<class T> using OptionalTable = fhicl::OptionalTable<T>;
using Comment = fhicl::Comment;
using Name = fhicl::Name;
using string = std::string;
Expand Down Expand Up @@ -470,6 +471,92 @@ namespace caf
25.
};

struct PFOCharLabels_t {
Atom<string> EndFractionName {
Name("EndFractionName"),
Comment("Provide the tool name for the EndFraction BDT variable."),
"LArThreeDChargeFeatureTool_EndFraction"
};

Atom<string> FractionalSpreadName {
Name("FractionalSpreadName"),
Comment("Provide the tool name for the FractionalSpread BDT variable."),
"LArThreeDChargeFeatureTool_FractionalSpread"
};

Atom<string> DiffStraightLineMeanName {
Name("DiffStraightLineMeanName"),
Comment("Provide the tool name for the DiffStraightLineMean BDT variable."),
"LArThreeDLinearFitFeatureTool_DiffStraightLineMean"
};

Atom<string> LengthName {
Name("LengthName"),
Comment("Provide the tool name for the Length BDT variable."),
"LArThreeDLinearFitFeatureTool_Length"
};

Atom<string> MaxFitGapLengthName {
Name("MaxFitGapLengthName"),
Comment("Provide the tool name for the MaxFitGapLength BDT variable."),
"LArThreeDLinearFitFeatureTool_MaxFitGapLength"
};

Atom<string> SlidingLinearFitRMSName {
Name("SlidingLinearFitRMSName"),
Comment("Provide the tool name for the SlidingLinearFitRMS BDT variable."),
"LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS"
};

Atom<string> AngleDiffName {
Name("AngleDiffName"),
Comment("Provide the tool name for the AngleDiff BDT variable."),
"LArThreeDOpeningAngleFeatureTool_AngleDiff"
};

Atom<string> SecondaryPCARatioName {
Name("SecondaryPCARatioName"),
Comment("Provide the tool name for the SecondaryPCARatio BDT variable."),
"LArThreeDPCAFeatureTool_SecondaryPCARatio"
};

Atom<string> TertiaryPCARatioName {
Name("TertiaryPCARatioName"),
Comment("Provide the tool name for the TertiaryPCARatio BDT variable."),
"LArThreeDPCAFeatureTool_TertiaryPCARatio"
};

Atom<string> VertexDistanceName {
Name("VertexDistanceName"),
Comment("Provide the tool name for the VertexDistance BDT variable."),
"LArThreeDVertexDistanceFeatureTool_VertexDistance"
};

Atom<string> HaloTotalRatioName {
Name("HaloTotalRatioName"),
Comment("Provide the tool name for the HaloTotalRatio BDT variable."),
"LArConeChargeFeatureTool_HaloTotalRatio"
};

Atom<string> ConcentrationName {
Name("ConcentrationName"),
Comment("Provide the tool name for the Concentration BDT variable."),
"LArConeChargeFeatureTool_Concentration"

};

Atom<string> ConicalnessName {
Name("ConicalnessName"),
Comment("Provide the tool name for the Conicalness BDT variable."),
"LArConeChargeFeatureTool_Conicalness"
};
};

OptionalTable<PFOCharLabels_t> PFOCharLabels {
Name("PFOCharLabels"),
Comment("Provide tool names for the Pandora track/shower discrimination BDT variables.")
};

Atom<bool> ReferencePMTFromTriggerToBeam {
Name("ReferencePMTFromTriggerToBeam"),
Comment("Whether to switch the reference time of PMT reco from 'trigger' to 'beam spill' time."),
Expand Down
19 changes: 18 additions & 1 deletion sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,24 @@ void CAFMaker::produce(art::Event& evt) noexcept {
}

const larpandoraobj::PFParticleMetadata *pfpMeta = (fmPFPMeta.at(iPart).empty()) ? NULL : fmPFPMeta.at(iPart).at(0).get();
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp);
caf::CAFMakerParams::PFOCharLabels_t const& pfoCharParams
= fParams.PFOCharLabels().value_or(caf::CAFMakerParams::PFOCharLabels_t{});
const caf::PFOCharLabelsStruct pfoCharLabels {
pfoCharParams.EndFractionName(),
pfoCharParams.FractionalSpreadName(),
pfoCharParams.DiffStraightLineMeanName(),
pfoCharParams.LengthName(),
pfoCharParams.MaxFitGapLengthName(),
pfoCharParams.SlidingLinearFitRMSName(),
pfoCharParams.AngleDiffName(),
pfoCharParams.SecondaryPCARatioName(),
pfoCharParams.TertiaryPCARatioName(),
pfoCharParams.VertexDistanceName(),
pfoCharParams.HaloTotalRatioName(),
pfoCharParams.ConcentrationName(),
pfoCharParams.ConicalnessName()
};
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp, pfoCharLabels);

if (fmCNNScores.isValid()) {
const sbn::PFPCNNScore *cnnScores = fmCNNScores.at(iPart).at(0).get();
Expand Down
27 changes: 14 additions & 13 deletions sbncode/CAFMaker/FillReco.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ namespace caf
const larpandoraobj::PFParticleMetadata *pfpMeta,
const art::Ptr<anab::T0> t0,
caf::SRPFP& srpfp,
const PFOCharLabelsStruct& pfoCharLabels,
bool allowEmpty)
{
srpfp.id = particle.Self();
Expand All @@ -1028,19 +1029,19 @@ namespace caf
// Pfo Characterisation features
srpfp.pfochar.setDefault();

CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_EndFraction", srpfp.pfochar.chgendfrac);
CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_FractionalSpread", srpfp.pfochar.chgfracspread);
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_DiffStraightLineMean", srpfp.pfochar.linfitdiff);
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_Length", srpfp.pfochar.linfitlen);
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_MaxFitGapLength", srpfp.pfochar.linfitgaplen);
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS", srpfp.pfochar.linfitrms);
CopyPropertyIfSet(propertiesMap, "LArThreeDOpeningAngleFeatureTool_AngleDiff", srpfp.pfochar.openanglediff);
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_SecondaryPCARatio", srpfp.pfochar.pca2ratio);
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_TertiaryPCARatio", srpfp.pfochar.pca3ratio);
CopyPropertyIfSet(propertiesMap, "LArThreeDVertexDistanceFeatureTool_VertexDistance", srpfp.pfochar.vtxdist);
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_HaloTotalRatio", srpfp.pfochar.halototratio);
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Concentration", srpfp.pfochar.concentration);
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Conicalness", srpfp.pfochar.conicalness);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.EndFractionName, srpfp.pfochar.chgendfrac);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.FractionalSpreadName, srpfp.pfochar.chgfracspread);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.DiffStraightLineMeanName, srpfp.pfochar.linfitdiff);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.LengthName, srpfp.pfochar.linfitlen);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.MaxFitGapLengthName, srpfp.pfochar.linfitgaplen);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SlidingLinearFitRMSName, srpfp.pfochar.linfitrms);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.AngleDiffName, srpfp.pfochar.openanglediff);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SecondaryPCARatioName, srpfp.pfochar.pca2ratio);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.TertiaryPCARatioName, srpfp.pfochar.pca3ratio);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.VertexDistanceName, srpfp.pfochar.vtxdist);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.HaloTotalRatioName, srpfp.pfochar.halototratio);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConcentrationName, srpfp.pfochar.concentration);
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConicalnessName, srpfp.pfochar.conicalness);
}
if (t0) {
srpfp.t0 = t0->Time() / 1e3; /* ns -> us */
Expand Down
19 changes: 18 additions & 1 deletion sbncode/CAFMaker/FillReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,29 @@ namespace caf
caf::SRHit& srhit,
bool allowEmpty = false);

struct PFOCharLabelsStruct {
std::string EndFractionName;
std::string FractionalSpreadName;
std::string DiffStraightLineMeanName;
std::string LengthName;
std::string MaxFitGapLengthName;
std::string SlidingLinearFitRMSName;
std::string AngleDiffName;
std::string SecondaryPCARatioName;
std::string TertiaryPCARatioName;
std::string VertexDistanceName;
std::string HaloTotalRatioName;
std::string ConcentrationName;
std::string ConicalnessName;
};

void FillPFPVars(const recob::PFParticle &particle,
const recob::PFParticle *primary,
const larpandoraobj::PFParticleMetadata *pfpMeta,
const art::Ptr<anab::T0> t0,
caf::SRPFP& srpfp,
bool allowEmpty= false);
const PFOCharLabelsStruct& pfoCharLabels,
bool allowEmpty = false);

void FillCNNScores(const recob::PFParticle &particle,
const sbn::PFPCNNScore *cnnscore,
Expand Down