diff --git a/sbncode/CAFMaker/CAFMakerParams.h b/sbncode/CAFMaker/CAFMakerParams.h index e2c2efbe8..2a88e15bf 100644 --- a/sbncode/CAFMaker/CAFMakerParams.h +++ b/sbncode/CAFMaker/CAFMakerParams.h @@ -16,6 +16,7 @@ namespace caf template using Atom = fhicl::Atom; template using Sequence = fhicl::Sequence; template using Table = fhicl::Table; + template using OptionalTable = fhicl::OptionalTable; using Comment = fhicl::Comment; using Name = fhicl::Name; using string = std::string; @@ -470,6 +471,92 @@ namespace caf 25. }; + struct PFOCharLabels_t { + Atom EndFractionName { + Name("EndFractionName"), + Comment("Provide the tool name for the EndFraction BDT variable."), + "LArThreeDChargeFeatureTool_EndFraction" + }; + + Atom FractionalSpreadName { + Name("FractionalSpreadName"), + Comment("Provide the tool name for the FractionalSpread BDT variable."), + "LArThreeDChargeFeatureTool_FractionalSpread" + }; + + Atom DiffStraightLineMeanName { + Name("DiffStraightLineMeanName"), + Comment("Provide the tool name for the DiffStraightLineMean BDT variable."), + "LArThreeDLinearFitFeatureTool_DiffStraightLineMean" + }; + + Atom LengthName { + Name("LengthName"), + Comment("Provide the tool name for the Length BDT variable."), + "LArThreeDLinearFitFeatureTool_Length" + }; + + Atom MaxFitGapLengthName { + Name("MaxFitGapLengthName"), + Comment("Provide the tool name for the MaxFitGapLength BDT variable."), + "LArThreeDLinearFitFeatureTool_MaxFitGapLength" + }; + + Atom SlidingLinearFitRMSName { + Name("SlidingLinearFitRMSName"), + Comment("Provide the tool name for the SlidingLinearFitRMS BDT variable."), + "LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS" + }; + + Atom AngleDiffName { + Name("AngleDiffName"), + Comment("Provide the tool name for the AngleDiff BDT variable."), + "LArThreeDOpeningAngleFeatureTool_AngleDiff" + }; + + Atom SecondaryPCARatioName { + Name("SecondaryPCARatioName"), + Comment("Provide the tool name for the SecondaryPCARatio BDT variable."), + "LArThreeDPCAFeatureTool_SecondaryPCARatio" + }; + + Atom TertiaryPCARatioName { + Name("TertiaryPCARatioName"), + Comment("Provide the tool name for the TertiaryPCARatio BDT variable."), + "LArThreeDPCAFeatureTool_TertiaryPCARatio" + }; + + Atom VertexDistanceName { + Name("VertexDistanceName"), + Comment("Provide the tool name for the VertexDistance BDT variable."), + "LArThreeDVertexDistanceFeatureTool_VertexDistance" + }; + + Atom HaloTotalRatioName { + Name("HaloTotalRatioName"), + Comment("Provide the tool name for the HaloTotalRatio BDT variable."), + "LArConeChargeFeatureTool_HaloTotalRatio" + }; + + Atom ConcentrationName { + Name("ConcentrationName"), + Comment("Provide the tool name for the Concentration BDT variable."), + "LArConeChargeFeatureTool_Concentration" + + }; + + Atom ConicalnessName { + Name("ConicalnessName"), + Comment("Provide the tool name for the Conicalness BDT variable."), + "LArConeChargeFeatureTool_Conicalness" + }; + }; + + OptionalTable PFOCharLabels { + Name("PFOCharLabels"), + Comment("Provide tool names for the Pandora track/shower discrimination BDT variables.") + }; + Atom ReferencePMTFromTriggerToBeam { Name("ReferencePMTFromTriggerToBeam"), Comment("Whether to switch the reference time of PMT reco from 'trigger' to 'beam spill' time."), diff --git a/sbncode/CAFMaker/CAFMaker_module.cc b/sbncode/CAFMaker/CAFMaker_module.cc index 29a35d0ee..9fcacfe0a 100644 --- a/sbncode/CAFMaker/CAFMaker_module.cc +++ b/sbncode/CAFMaker/CAFMaker_module.cc @@ -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(); diff --git a/sbncode/CAFMaker/FillReco.cxx b/sbncode/CAFMaker/FillReco.cxx index 95e76532b..fb329e9d0 100644 --- a/sbncode/CAFMaker/FillReco.cxx +++ b/sbncode/CAFMaker/FillReco.cxx @@ -1005,6 +1005,7 @@ namespace caf const larpandoraobj::PFParticleMetadata *pfpMeta, const art::Ptr t0, caf::SRPFP& srpfp, + const PFOCharLabelsStruct& pfoCharLabels, bool allowEmpty) { srpfp.id = particle.Self(); @@ -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 */ diff --git a/sbncode/CAFMaker/FillReco.h b/sbncode/CAFMaker/FillReco.h index eb4a034df..b486d2eec 100644 --- a/sbncode/CAFMaker/FillReco.h +++ b/sbncode/CAFMaker/FillReco.h @@ -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 t0, caf::SRPFP& srpfp, - bool allowEmpty= false); + const PFOCharLabelsStruct& pfoCharLabels, + bool allowEmpty = false); void FillCNNScores(const recob::PFParticle &particle, const sbn::PFPCNNScore *cnnscore,