Skip to content

Commit 7241a86

Browse files
authored
Merge pull request #546 from SBNSoftware/feature/rtriozzi_TrackShowerDiscrimination_ICARUSCollection
CAFMaker changes to accomodate for Pandora track/shower discrimination changes
2 parents d8b2f20 + 9679715 commit 7241a86

File tree

4 files changed

+137
-15
lines changed

4 files changed

+137
-15
lines changed

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace caf
1616
template<class T> using Atom = fhicl::Atom<T>;
1717
template<class T> using Sequence = fhicl::Sequence<T>;
1818
template<class T> using Table = fhicl::Table<T>;
19+
template<class T> using OptionalTable = fhicl::OptionalTable<T>;
1920
using Comment = fhicl::Comment;
2021
using Name = fhicl::Name;
2122
using string = std::string;
@@ -470,6 +471,92 @@ namespace caf
470471
25.
471472
};
472473

474+
struct PFOCharLabels_t {
475+
Atom<string> EndFractionName {
476+
Name("EndFractionName"),
477+
Comment("Provide the tool name for the EndFraction BDT variable."),
478+
"LArThreeDChargeFeatureTool_EndFraction"
479+
};
480+
481+
Atom<string> FractionalSpreadName {
482+
Name("FractionalSpreadName"),
483+
Comment("Provide the tool name for the FractionalSpread BDT variable."),
484+
"LArThreeDChargeFeatureTool_FractionalSpread"
485+
};
486+
487+
Atom<string> DiffStraightLineMeanName {
488+
Name("DiffStraightLineMeanName"),
489+
Comment("Provide the tool name for the DiffStraightLineMean BDT variable."),
490+
"LArThreeDLinearFitFeatureTool_DiffStraightLineMean"
491+
};
492+
493+
Atom<string> LengthName {
494+
Name("LengthName"),
495+
Comment("Provide the tool name for the Length BDT variable."),
496+
"LArThreeDLinearFitFeatureTool_Length"
497+
};
498+
499+
Atom<string> MaxFitGapLengthName {
500+
Name("MaxFitGapLengthName"),
501+
Comment("Provide the tool name for the MaxFitGapLength BDT variable."),
502+
"LArThreeDLinearFitFeatureTool_MaxFitGapLength"
503+
};
504+
505+
Atom<string> SlidingLinearFitRMSName {
506+
Name("SlidingLinearFitRMSName"),
507+
Comment("Provide the tool name for the SlidingLinearFitRMS BDT variable."),
508+
"LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS"
509+
};
510+
511+
Atom<string> AngleDiffName {
512+
Name("AngleDiffName"),
513+
Comment("Provide the tool name for the AngleDiff BDT variable."),
514+
"LArThreeDOpeningAngleFeatureTool_AngleDiff"
515+
};
516+
517+
Atom<string> SecondaryPCARatioName {
518+
Name("SecondaryPCARatioName"),
519+
Comment("Provide the tool name for the SecondaryPCARatio BDT variable."),
520+
"LArThreeDPCAFeatureTool_SecondaryPCARatio"
521+
};
522+
523+
Atom<string> TertiaryPCARatioName {
524+
Name("TertiaryPCARatioName"),
525+
Comment("Provide the tool name for the TertiaryPCARatio BDT variable."),
526+
"LArThreeDPCAFeatureTool_TertiaryPCARatio"
527+
};
528+
529+
Atom<string> VertexDistanceName {
530+
Name("VertexDistanceName"),
531+
Comment("Provide the tool name for the VertexDistance BDT variable."),
532+
"LArThreeDVertexDistanceFeatureTool_VertexDistance"
533+
};
534+
535+
Atom<string> HaloTotalRatioName {
536+
Name("HaloTotalRatioName"),
537+
Comment("Provide the tool name for the HaloTotalRatio BDT variable."),
538+
"LArConeChargeFeatureTool_HaloTotalRatio"
539+
};
540+
541+
Atom<string> ConcentrationName {
542+
Name("ConcentrationName"),
543+
Comment("Provide the tool name for the Concentration BDT variable."),
544+
"LArConeChargeFeatureTool_Concentration"
545+
546+
};
547+
548+
Atom<string> ConicalnessName {
549+
Name("ConicalnessName"),
550+
Comment("Provide the tool name for the Conicalness BDT variable."),
551+
"LArConeChargeFeatureTool_Conicalness"
552+
};
553+
};
554+
555+
OptionalTable<PFOCharLabels_t> PFOCharLabels {
556+
Name("PFOCharLabels"),
557+
Comment("Provide tool names for the Pandora track/shower discrimination BDT variables.")
558+
};
559+
473560
Atom<bool> ReferencePMTFromTriggerToBeam {
474561
Name("ReferencePMTFromTriggerToBeam"),
475562
Comment("Whether to switch the reference time of PMT reco from 'trigger' to 'beam spill' time."),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,24 @@ void CAFMaker::produce(art::Event& evt) noexcept {
22532253
}
22542254

22552255
const larpandoraobj::PFParticleMetadata *pfpMeta = (fmPFPMeta.at(iPart).empty()) ? NULL : fmPFPMeta.at(iPart).at(0).get();
2256-
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp);
2256+
caf::CAFMakerParams::PFOCharLabels_t const& pfoCharParams
2257+
= fParams.PFOCharLabels().value_or(caf::CAFMakerParams::PFOCharLabels_t{});
2258+
const caf::PFOCharLabelsStruct pfoCharLabels {
2259+
pfoCharParams.EndFractionName(),
2260+
pfoCharParams.FractionalSpreadName(),
2261+
pfoCharParams.DiffStraightLineMeanName(),
2262+
pfoCharParams.LengthName(),
2263+
pfoCharParams.MaxFitGapLengthName(),
2264+
pfoCharParams.SlidingLinearFitRMSName(),
2265+
pfoCharParams.AngleDiffName(),
2266+
pfoCharParams.SecondaryPCARatioName(),
2267+
pfoCharParams.TertiaryPCARatioName(),
2268+
pfoCharParams.VertexDistanceName(),
2269+
pfoCharParams.HaloTotalRatioName(),
2270+
pfoCharParams.ConcentrationName(),
2271+
pfoCharParams.ConicalnessName()
2272+
};
2273+
FillPFPVars(thisParticle, primary, pfpMeta, thisPFPT0, pfp, pfoCharLabels);
22572274

22582275
if (fmCNNScores.isValid()) {
22592276
const sbn::PFPCNNScore *cnnScores = fmCNNScores.at(iPart).at(0).get();

sbncode/CAFMaker/FillReco.cxx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,7 @@ namespace caf
10051005
const larpandoraobj::PFParticleMetadata *pfpMeta,
10061006
const art::Ptr<anab::T0> t0,
10071007
caf::SRPFP& srpfp,
1008+
const PFOCharLabelsStruct& pfoCharLabels,
10081009
bool allowEmpty)
10091010
{
10101011
srpfp.id = particle.Self();
@@ -1028,19 +1029,19 @@ namespace caf
10281029
// Pfo Characterisation features
10291030
srpfp.pfochar.setDefault();
10301031

1031-
CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_EndFraction", srpfp.pfochar.chgendfrac);
1032-
CopyPropertyIfSet(propertiesMap, "LArThreeDChargeFeatureTool_FractionalSpread", srpfp.pfochar.chgfracspread);
1033-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_DiffStraightLineMean", srpfp.pfochar.linfitdiff);
1034-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_Length", srpfp.pfochar.linfitlen);
1035-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_MaxFitGapLength", srpfp.pfochar.linfitgaplen);
1036-
CopyPropertyIfSet(propertiesMap, "LArThreeDLinearFitFeatureTool_SlidingLinearFitRMS", srpfp.pfochar.linfitrms);
1037-
CopyPropertyIfSet(propertiesMap, "LArThreeDOpeningAngleFeatureTool_AngleDiff", srpfp.pfochar.openanglediff);
1038-
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_SecondaryPCARatio", srpfp.pfochar.pca2ratio);
1039-
CopyPropertyIfSet(propertiesMap, "LArThreeDPCAFeatureTool_TertiaryPCARatio", srpfp.pfochar.pca3ratio);
1040-
CopyPropertyIfSet(propertiesMap, "LArThreeDVertexDistanceFeatureTool_VertexDistance", srpfp.pfochar.vtxdist);
1041-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_HaloTotalRatio", srpfp.pfochar.halototratio);
1042-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Concentration", srpfp.pfochar.concentration);
1043-
CopyPropertyIfSet(propertiesMap, "LArConeChargeFeatureTool_Conicalness", srpfp.pfochar.conicalness);
1032+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.EndFractionName, srpfp.pfochar.chgendfrac);
1033+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.FractionalSpreadName, srpfp.pfochar.chgfracspread);
1034+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.DiffStraightLineMeanName, srpfp.pfochar.linfitdiff);
1035+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.LengthName, srpfp.pfochar.linfitlen);
1036+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.MaxFitGapLengthName, srpfp.pfochar.linfitgaplen);
1037+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SlidingLinearFitRMSName, srpfp.pfochar.linfitrms);
1038+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.AngleDiffName, srpfp.pfochar.openanglediff);
1039+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.SecondaryPCARatioName, srpfp.pfochar.pca2ratio);
1040+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.TertiaryPCARatioName, srpfp.pfochar.pca3ratio);
1041+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.VertexDistanceName, srpfp.pfochar.vtxdist);
1042+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.HaloTotalRatioName, srpfp.pfochar.halototratio);
1043+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConcentrationName, srpfp.pfochar.concentration);
1044+
CopyPropertyIfSet(propertiesMap, pfoCharLabels.ConicalnessName, srpfp.pfochar.conicalness);
10441045
}
10451046
if (t0) {
10461047
srpfp.t0 = t0->Time() / 1e3; /* ns -> us */

sbncode/CAFMaker/FillReco.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,29 @@ namespace caf
140140
caf::SRHit& srhit,
141141
bool allowEmpty = false);
142142

143+
struct PFOCharLabelsStruct {
144+
std::string EndFractionName;
145+
std::string FractionalSpreadName;
146+
std::string DiffStraightLineMeanName;
147+
std::string LengthName;
148+
std::string MaxFitGapLengthName;
149+
std::string SlidingLinearFitRMSName;
150+
std::string AngleDiffName;
151+
std::string SecondaryPCARatioName;
152+
std::string TertiaryPCARatioName;
153+
std::string VertexDistanceName;
154+
std::string HaloTotalRatioName;
155+
std::string ConcentrationName;
156+
std::string ConicalnessName;
157+
};
158+
143159
void FillPFPVars(const recob::PFParticle &particle,
144160
const recob::PFParticle *primary,
145161
const larpandoraobj::PFParticleMetadata *pfpMeta,
146162
const art::Ptr<anab::T0> t0,
147163
caf::SRPFP& srpfp,
148-
bool allowEmpty= false);
164+
const PFOCharLabelsStruct& pfoCharLabels,
165+
bool allowEmpty = false);
149166

150167
void FillCNNScores(const recob::PFParticle &particle,
151168
const sbn::PFPCNNScore *cnnscore,

0 commit comments

Comments
 (0)