Skip to content
Open
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
3 changes: 2 additions & 1 deletion PhysicsTools/JetMCAlgos/plugins/GenHFHadronMatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,8 @@ int GenHFHadronMatcher::findInMothers(int idx,
}
int pdg_2 = hadMothers[idx2].pdgId();
// Inverting the flavour if bb oscillation detected
if (isHadronPdgId(pdgId, pdg_1) && isHadronPdgId(pdgId, pdg_2) && pdg_1 * pdg_2 < 0) {
if (isHadronPdgId(pdgId, pdg_1) && isHadronPdgId(pdgId, pdg_2) &&
((pdg_1 < 0 && pdg_2 > 0) || (pdg_1 > 0 && pdg_2 < 0))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option would be
std::signbit(pdg_1) xor std::signbit(pdg_2)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones , I think std::signbit(pdg_1) xor std::signbit(pdg_2) might not work if one of these variables hold 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but 0 is not a valid value for a PDG id (according to my internet search). Therefore no particle is ever supposed to have that value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok, in that case ((pdg_1 < 0) != (pdg_2 < 0)) should be enough but may be then we should add assert to make sure values are not zero

pdgId *= -1;
if (verbose)
printf("######### Inverting flavour of the hadron\n");
Expand Down