Skip to content

Commit 2af2c08

Browse files
committed
updating FillReco for likelihood pid
1 parent 9bea391 commit 2af2c08

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

sbncode/CAFMaker/FillReco.cxx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,53 @@ namespace caf
892892
}
893893
}
894894

895+
void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikePID &srlikepid) {
896+
897+
// Assign dummy values.
898+
899+
srlikepid.lambda_muon = 0.;
900+
srlikepid.lambda_pion = 0.;
901+
srlikepid.lambda_proton = 0.;
902+
srlikepid.pid_ndof = 0;
903+
904+
// Loop over algorithm scores and extract the ones we want.
905+
// Get the ndof from any likelihood pid algorithm
906+
907+
std::vector<anab::sParticleIDAlgScores> AlgScoresVec = particle_id.ParticleIDAlgScores();
908+
for (size_t i_algscore=0; i_algscore<AlgScoresVec.size(); i_algscore++){
909+
anab::sParticleIDAlgScores AlgScore = AlgScoresVec.at(i_algscore);
910+
if (AlgScore.fAlgName == "Likelihood"){
911+
if (TMath::Abs(AlgScore.fAssumedPdg) == 13) { // lambda_mu
912+
srlikepid.lambda_muon = AlgScore.fValue;
913+
srlikepid.pid_ndof = AlgScore.fNdf;
914+
}
915+
else if (TMath::Abs(AlgScore.fAssumedPdg) == 211) { // lambda_pi
916+
srlikepid.lambda_pion = AlgScore.fValue;
917+
srlikepid.pid_ndof = AlgScore.fNdf;
918+
}
919+
else if (TMath::Abs(AlgScore.fAssumedPdg) == 2212) { // lambda_pr
920+
srlikepid.lambda_proton = AlgScore.fValue;
921+
srlikepid.pid_ndof = AlgScore.fNdf;
922+
}
923+
}
924+
}
925+
}
926+
927+
void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
928+
caf::SRTrack& srtrack,
929+
bool allowEmpty)
930+
{
931+
// get the particle ID's
932+
for (unsigned i = 0; i < particleIDs.size(); i++) {
933+
const anab::ParticleID &particle_id = *particleIDs[i];
934+
if (particle_id.PlaneID()) {
935+
unsigned plane_id = particle_id.PlaneID().Plane;
936+
assert(plane_id < 3);
937+
FillPlaneLikePID(particle_id, srtrack.likepid[plane_id]);
938+
}
939+
}
940+
}
941+
895942
void FillTrackPlaneCalo(const anab::Calorimetry &calo,
896943
const std::vector<art::Ptr<recob::Hit>> &hits,
897944
bool fill_calo_points, float fillhit_rrstart, float fillhit_rrend,

sbncode/CAFMaker/FillReco.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ namespace caf
226226
void FillTrackChi2PID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
227227
caf::SRTrack& srtrack,
228228
bool allowEmpty = false);
229+
void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikePID &srlikepid);
230+
void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs,
231+
caf::SRTrack& srtrack,
232+
bool allowEmptySRTrkLikePID);
229233

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

0 commit comments

Comments
 (0)