Skip to content
Merged
Changes from 2 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
43 changes: 37 additions & 6 deletions PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@
V0Unmatched
};

// Convert the KFParticle PDG code to the O2 track PID enum needed by getTrackParCovFromKFP()
o2::track::PID::ID getTrackPIDFromPDG(const int pdg)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is no way this conversion does not exist in some common utilities yet.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@vkucera I had a quick look in O2 and O2Physics and I didn't find any common utility. Similar functions are defined in a couple of other places (

int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
and
int getPIDIndex(const int pdgCode) // Get O2 PID index corresponding to MC PDG code
).
Do you have a concrete common utility that could be used?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the links. I expected this to already exist somewhere close to the declaration of the o2::track::PID::ID but it seems I was wrong.

{
switch (std::abs(pdg)) {
case 211:
return o2::track::PID::Pion;
case 321:
return o2::track::PID::Kaon;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't use magic numbers.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mtorresc15 You can have a look here https://root.cern/doc/v640/TPDGCode_8h.html for the PDG constant definitions.

case 2212:
return o2::track::PID::Proton;
case 3122:
return o2::track::PID::Lambda;
case 3312:
return o2::track::PID::XiMinus;
case 3334:
return o2::track::PID::OmegaMinus;
default:
LOGF(fatal, "Unsupported PDG code %d in getTrackPIDFromPDG()", pdg);
return o2::track::PID::Pion;

Check failure on line 117 in PWGHF/TableProducer/candidateCreatorXic0Omegac0.cxx

View workflow job for this annotation

GitHub Actions / PR formatting / whitespace

Trailing spaces

Remove the trailing spaces at the end of the line.
}
}

// Reconstruction of omegac0 and xic0 candidates
struct HfCandidateCreatorXic0Omegac0 {
Produces<aod::HfCandToXiPi> rowCandToXiPi;
Expand Down Expand Up @@ -959,12 +981,16 @@

omegaDauChargedTrackParCov = getTrackParCovFromKFP(kfBachKaonToOmega, o2::track::PID::Kaon, bachCharge); // Cascade bach kaon
omegaDauChargedTrackParCov.setAbsCharge(1);
o2::track::TrackParCov trackCasc = getTrackParCovFromKFP(kfOmegaToOmegaC, kfOmegaToOmegaC.GetPDG(), bachCharge);
o2::track::PID::ID pidCasc = getTrackPIDFromPDG(kfOmegaToOmegaC.GetPDG());
o2::track::TrackParCov trackCasc = getTrackParCovFromKFP(kfOmegaToOmegaC, pidCasc, bachCharge);
trackCasc.setAbsCharge(1);

trackParCovV0Dau0 = getTrackParCovFromKFP(kfPos, kfPos.GetPDG(), 1); // V0 postive daughter
o2::track::PID::ID pidV0Dau0 = getTrackPIDFromPDG(kfPos.GetPDG());
trackParCovV0Dau0 = getTrackParCovFromKFP(kfPos, pidV0Dau0, +1); // V0 postive daughter
trackParCovV0Dau0.setAbsCharge(1);
trackParCovV0Dau1 = getTrackParCovFromKFP(kfNeg, kfNeg.GetPDG(), -1); // V0 negtive daughter

o2::track::PID::ID pidV0Dau1 = getTrackPIDFromPDG(kfNeg.GetPDG());
trackParCovV0Dau1 = getTrackParCovFromKFP(kfNeg, pidV0Dau1, -1); // V0 negative daughter
trackParCovV0Dau1.setAbsCharge(1);

//-------------------------- V0 info---------------------------
Expand Down Expand Up @@ -1452,12 +1478,17 @@

xiDauChargedTrackParCov = getTrackParCovFromKFP(kfBachPionToXi, o2::track::PID::Pion, bachCharge); // Cascade bach pion
xiDauChargedTrackParCov.setAbsCharge(1);
o2::track::TrackParCov trackCasc = getTrackParCovFromKFP(kfXiToXiC, kfXiToXiC.GetPDG(), bachCharge);

o2::track::PID::ID pidCasc = getTrackPIDFromPDG(kfXiToXiC.GetPDG());
o2::track::TrackParCov trackCasc = getTrackParCovFromKFP(kfXiToXiC, pidCasc, bachCharge);
trackCasc.setAbsCharge(1);

trackParCovV0Dau0 = getTrackParCovFromKFP(kfPos, kfPos.GetPDG(), 1); // V0 postive daughter
o2::track::PID::ID pidV0Dau0 = getTrackPIDFromPDG(kfPos.GetPDG());
trackParCovV0Dau0 = getTrackParCovFromKFP(kfPos, pidV0Dau0, +1); // V0 postive daughter
trackParCovV0Dau0.setAbsCharge(1);
trackParCovV0Dau1 = getTrackParCovFromKFP(kfNeg, kfNeg.GetPDG(), -1); // V0 negtive daughter

o2::track::PID::ID pidV0Dau1 = getTrackPIDFromPDG(kfNeg.GetPDG());
trackParCovV0Dau1 = getTrackParCovFromKFP(kfNeg, pidV0Dau1, -1); // V0 negative daughter
trackParCovV0Dau1.setAbsCharge(1);

//-------------------------- V0 info---------------------------
Expand Down
Loading