Skip to content
Open
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
6 changes: 6 additions & 0 deletions sbncode/CAFMaker/CAFMakerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ namespace caf
"pandoraPid"
};

Atom<string> TrackLikePidLabel {
Name("TrackLikePidLabel"),
Comment("Base label of track likelihood particle-id producer."),
"pandoraLikePid"
};

Atom<string> TrackScatterClosestApproachLabel {
Name("TrackScatterClosestApproachLabel"),
Comment("Base label of track track scatter closestapproach producer."),
Expand Down
7 changes: 7 additions & 0 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2125,6 +2125,10 @@ void CAFMaker::produce(art::Event& evt) noexcept {
FindManyPStrict<anab::ParticleID>(slcTracks, evt,
fParams.TrackChi2PidLabel() + slice_tag_suff);

art::FindManyP<anab::ParticleID> fmLikePID =
FindManyPStrict<anab::ParticleID>(slcTracks, evt,
fParams.TrackLikePidLabel() + slice_tag_suff);

art::FindManyP<sbn::ScatterClosestApproach> fmScatterClosestApproach =
FindManyPStrict<sbn::ScatterClosestApproach>(slcTracks, evt,
fParams.TrackScatterClosestApproachLabel() + slice_tag_suff);
Expand Down Expand Up @@ -2416,6 +2420,9 @@ void CAFMaker::produce(art::Event& evt) noexcept {
if (fmChi2PID.isValid()) {
FillTrackChi2PID(fmChi2PID.at(iPart), trk);
}
if (fmLikePID.isValid()) {
FillTrackLikePID(fmLikePID.at(iPart), trk);
}
if (fmScatterClosestApproach.isValid() && fmScatterClosestApproach.at(iPart).size()==1) {
FillTrackScatterClosestApproach(fmScatterClosestApproach.at(iPart).front(), trk);
}
Expand Down
42 changes: 42 additions & 0 deletions sbncode/CAFMaker/FillReco.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,48 @@ namespace caf
}
}

void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikelihoodPID &srlikepid) {

// Loop over algorithm scores and extract the ones we want.
// Get the ndof from any likelihood pid algorithm
srlikepid.setDefault();

std::vector<anab::sParticleIDAlgScores> const& AlgScoresVec = particle_id.ParticleIDAlgScores();
for (anab::sParticleIDAlgScores const& AlgScore: AlgScoresVec){
if (AlgScore.fAlgName == "Likelihood"){
switch (std::abs(AlgScore.fAssumedPdg)) {
case 13: // lambda_mu
srlikepid.lambda_muon = AlgScore.fValue;
srlikepid.pid_ndof = AlgScore.fNdf;
break;
case 211: // lambda_pi
srlikepid.lambda_pion = AlgScore.fValue;
srlikepid.pid_ndof = AlgScore.fNdf;
break;
case 2212: // lambda_pr
srlikepid.lambda_proton = AlgScore.fValue;
srlikepid.pid_ndof = AlgScore.fNdf;
break;
}
}
}
}

void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs,
caf::SRTrack& srtrack,
bool allowEmpty)
{
// get the particle ID's
for (art::Ptr<anab::ParticleID> const& pidPtr: particleIDs) {
const anab::ParticleID &particle_id = *pidPtr;
if (particle_id.PlaneID()) {
unsigned plane_id = particle_id.PlaneID().Plane;
assert(plane_id < 3);
FillPlaneLikePID(particle_id, srtrack.likepid[plane_id]);
}
}
}

void FillTrackPlaneCalo(const anab::Calorimetry &calo,
const std::vector<art::Ptr<recob::Hit>> &hits,
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,
Expand Down
4 changes: 4 additions & 0 deletions sbncode/CAFMaker/FillReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ namespace caf
void FillTrackChi2PID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
caf::SRTrack& srtrack,
bool allowEmpty = false);
void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikelihoodPID &srlikepid);
void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs,
caf::SRTrack& srtrack,
bool allowEmpty = false);

void FillTrackPlaneCalo(const anab::Calorimetry &calo,
const std::vector<art::Ptr<recob::Hit>> &hits,
Expand Down