-
Notifications
You must be signed in to change notification settings - Fork 36
Feature/sungbino likepid into cafmaker #593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
9bea391
2af2c08
3eeef15
2af891e
2651da1
ff96233
264bd4f
4c47688
ad25a04
c48e4bf
4346c58
4309dfe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -892,6 +892,53 @@ namespace caf | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void FillPlaneLikePID(const anab::ParticleID &particle_id, caf::SRTrkLikelihoodPID &srlikepid) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Assign dummy values. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| srlikepid.lambda_muon = -9999.; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| srlikepid.lambda_pion = -9999.; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| srlikepid.lambda_proton = -9999.; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| srlikepid.pid_ndof = -5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Loop over algorithm scores and extract the ones we want. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Get the ndof from any likelihood pid algorithm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::vector<anab::sParticleIDAlgScores> AlgScoresVec = particle_id.ParticleIDAlgScores(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::vector<anab::sParticleIDAlgScores> AlgScoresVec = particle_id.ParticleIDAlgScores(); | |
| std::vector<anab::sParticleIDAlgScores> const& AlgScoresVec = particle_id.ParticleIDAlgScores(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the suggested change.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid copying the objects, and also compact the notation:
| for (size_t i_algscore=0; i_algscore<AlgScoresVec.size(); i_algscore++){ | |
| anab::sParticleIDAlgScores AlgScore = AlgScoresVec.at(i_algscore); | |
| for (anab::sParticleIDAlgScores const& AlgScore: AlgScoresVec){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the suggested change.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the cases are known integral numbers, it's more efficient to use switch:
| if (TMath::Abs(AlgScore.fAssumedPdg) == 13) { // lambda_mu | |
| srlikepid.lambda_muon = AlgScore.fValue; | |
| srlikepid.pid_ndof = AlgScore.fNdf; | |
| } | |
| else if (TMath::Abs(AlgScore.fAssumedPdg) == 211) { // lambda_pi | |
| srlikepid.lambda_pion = AlgScore.fValue; | |
| srlikepid.pid_ndof = AlgScore.fNdf; | |
| } | |
| else if (TMath::Abs(AlgScore.fAssumedPdg) == 2212) { // lambda_pr | |
| srlikepid.lambda_proton = AlgScore.fValue; | |
| srlikepid.pid_ndof = AlgScore.fNdf; | |
| } | |
| 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; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the suggested change.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass the particle ID pointer objects by reference ([CF-112]):
| void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs, | |
| void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added &.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can compact this avoiding i:
| for (unsigned i = 0; i < particleIDs.size(); i++) { | |
| const anab::ParticleID &particle_id = *particleIDs[i]; | |
| for (art::Ptr<anab::ParticleID> const& pidPtr: particleIDs) { | |
| const anab::ParticleID &particle_id = *pidPtr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to the suggested change.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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, | ||||||
|
||||||
| void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>> particleIDs, | |
| void FillTrackLikePID(const std::vector<art::Ptr<anab::ParticleID>>& particleIDs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added &.
Uh oh!
There was an error while loading. Please reload this page.