Skip to content
Closed
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
16 changes: 2 additions & 14 deletions PWGLF/DataModel/Vtx3BodyTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,6 @@ using Vtx3BodyDatasCovsIndexed = soa::Join<Vtx3BodyDatas, Vtx3BodyCovs, Decay3Bo

namespace nuclei3body
{
DECLARE_SOA_INDEX_COLUMN_FULL(Helium3Track, helium3Track, int, Tracks, "_He3"); //!
DECLARE_SOA_INDEX_COLUMN_FULL(Daughter1Track, daughter1Track, int, Tracks, "_D1"); //!
DECLARE_SOA_INDEX_COLUMN_FULL(Daughter2Track, daughter2Track, int, Tracks, "_D2"); //!
DECLARE_SOA_INDEX_COLUMN(Collision, collision); //!

DECLARE_SOA_COLUMN(SignHe3, signHe3, int8_t); //! He3 charge sign
DECLARE_SOA_COLUMN(SignDaughter1, signDaughter1, int8_t); //! daughter 1 charge sign
DECLARE_SOA_COLUMN(SignDaughter2, signDaughter2, int8_t); //! daughter 2 charge sign
Expand Down Expand Up @@ -388,14 +383,10 @@ DECLARE_SOA_COLUMN(ItsNClsHe3, itsNClsHe3, uint8_t);
DECLARE_SOA_COLUMN(ItsNClsDaughter1, itsNClsDaughter1, uint8_t);
DECLARE_SOA_COLUMN(ItsNClsDaughter2, itsNClsDaughter2, uint8_t);

DECLARE_SOA_COLUMN(McLabelHe3, mcLabelHe3, int);
DECLARE_SOA_COLUMN(McLabelDaughter1, mcLabelDaughter1, int);
DECLARE_SOA_COLUMN(McLabelDaughter2, mcLabelDaughter2, int);
DECLARE_SOA_COLUMN(McPdgHe3, mcPdgHe3, int);
DECLARE_SOA_COLUMN(McPdgDaughter1, mcPdgDaughter1, int);
DECLARE_SOA_COLUMN(McPdgDaughter2, mcPdgDaughter2, int);
DECLARE_SOA_COLUMN(McMatchStatus, mcMatchStatus, uint8_t); //! 0 missing label, 1 no common mother, 2 common mother, 3 configured decay
DECLARE_SOA_COLUMN(McMotherLabel, mcMotherLabel, int);
DECLARE_SOA_COLUMN(McMotherPdg, mcMotherPdg, int);
DECLARE_SOA_COLUMN(GenMotherPt, genMotherPt, float);
DECLARE_SOA_COLUMN(GenMotherEta, genMotherEta, float);
Expand All @@ -404,9 +395,7 @@ DECLARE_SOA_COLUMN(GenDecayLength, genDecayLength, float);
} // namespace nuclei3body

#define NUCLEI_THREE_BODY_RECO_COLUMNS \
nuclei3body::Helium3TrackId, nuclei3body::Daughter1TrackId, \
nuclei3body::Daughter2TrackId, nuclei3body::CollisionId, \
nuclei3body::SignHe3, nuclei3body::SignDaughter1, nuclei3body::SignDaughter2, \
nuclei3body::SignHe3, nuclei3body::SignDaughter1, nuclei3body::SignDaughter2, \
nuclei3body::Pt, nuclei3body::Eta, nuclei3body::Phi, \
nuclei3body::PHe3, nuclei3body::PDaughter1, nuclei3body::PDaughter2, \
nuclei3body::Chi2, nuclei3body::DcaDaughters, nuclei3body::CosPA, \
Expand All @@ -433,9 +422,8 @@ DECLARE_SOA_TABLE(NucleiThreeBodyDatas, "AOD", "NUC3BODYDATA",
DECLARE_SOA_TABLE(McNucleiThreeBodyDatas, "AOD", "MCNUC3BODY",
o2::soa::Index<>,
NUCLEI_THREE_BODY_RECO_COLUMNS,
nuclei3body::McLabelHe3, nuclei3body::McLabelDaughter1, nuclei3body::McLabelDaughter2,
nuclei3body::McPdgHe3, nuclei3body::McPdgDaughter1, nuclei3body::McPdgDaughter2,
nuclei3body::McMatchStatus, nuclei3body::McMotherLabel, nuclei3body::McMotherPdg,
nuclei3body::McMatchStatus, nuclei3body::McMotherPdg,
nuclei3body::GenMotherPt, nuclei3body::GenMotherEta,
nuclei3body::GenMotherPhi, nuclei3body::GenDecayLength);

Expand Down
19 changes: 11 additions & 8 deletions PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
o2::parameters::GRPMagField* grpmag = 0x0;
if (grpo) {
o2::base::Propagator::initFieldFromGRP(grpo);
if (d_bz_input < -990) {

Check failure on line 411 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// Fetch magnetic field from ccdb for current collision
d_bz = grpo->getNominalL3Field();
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG";
Expand All @@ -421,7 +421,7 @@
LOG(fatal) << "Got nullptr from CCDB for path " << grpmagPath << " of object GRPMagField and " << grpPath << " of object GRPObject for timestamp " << run3grp_timestamp;
}
o2::base::Propagator::initFieldFromGRP(grpmag);
if (d_bz_input < -990) {

Check failure on line 424 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
// Fetch magnetic field from ccdb for current collision
d_bz = std::lround(5.f * grpmag->getL3Current() / 30000.f);
LOG(info) << "Retrieved GRP for timestamp " << run3grp_timestamp << " with magnetic field of " << d_bz << " kZG";
Expand All @@ -433,7 +433,7 @@
auto he3pid = ccdb->getForTimeStamp<std::array<float, 6>>(pidPath.value + "_He3", run3grp_timestamp);
std::copy(he3pid->begin(), he3pid->end(), mBBparamsHe.begin());
} else {
for (int i = 0; i < 5; i++) {

Check failure on line 436 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
mBBparamsHe[i] = cfgBetheBlochParams->get("He3", Form("p%i", i));
}
mBBparamsHe[5] = cfgBetheBlochParams->get("He3", "resolution");
Expand Down Expand Up @@ -479,7 +479,7 @@

hEvents->Fill(1.);

if (std::abs(collision.posZ()) > 10) {

Check failure on line 482 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}
hEvents->Fill(2.);
Expand Down Expand Up @@ -524,7 +524,7 @@

hEvents->Fill(1.);

if (std::abs(collision.posZ()) > 10) {

Check failure on line 527 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}
hEvents->Fill(2.);
Expand Down Expand Up @@ -599,7 +599,7 @@
hePropTrack.getPxPyPzGlo(hypCand.momHe3);
piPropTrack.getPxPyPzGlo(hypCand.momPi);
// the momentum has to be multiplied by 2 (charge)
for (int i = 0; i < 3; i++) {

Check failure on line 602 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
hypCand.momHe3[i] *= 2;
}
float heP2 = hypCand.momHe3[0] * hypCand.momHe3[0] + hypCand.momHe3[1] * hypCand.momHe3[1] + hypCand.momHe3[2] * hypCand.momHe3[2];
Expand All @@ -611,7 +611,7 @@
float h4lE = he4E + piE;
std::array<float, 3> hypMom;
const auto& vtx = fitter.getPCACandidate();
for (int i = 0; i < 3; i++) {

Check failure on line 614 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
hypCand.decVtx[i] = vtx[i];
hypMom[i] = hypCand.momHe3[i] + hypCand.momPi[i];
}
Expand Down Expand Up @@ -664,7 +664,7 @@

auto collision = collisions.rawIteratorAt(collIDmax);
std::array<float, 3> primVtx = {collision.posX(), collision.posY(), collision.posZ()};
for (int i = 0; i < 3; i++) {

Check failure on line 667 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
hypCand.decVtx[i] = hypCand.decVtx[i] - primVtx[i];
}

Expand Down Expand Up @@ -783,7 +783,7 @@
}
void fillMCinfo(aod::McTrackLabels const& trackLabels, aod::McParticles const&)
{
for (auto& hypCand : hyperCandidates) {

Check failure on line 786 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto mcLabHe = trackLabels.rawIteratorAt(hypCand.heTrackID);
auto mcLabPi = trackLabels.rawIteratorAt(hypCand.piTrackID);

Expand All @@ -804,7 +804,7 @@
auto secVtx = std::array<float, 3>{mcTrackHe.vx(), mcTrackHe.vy(), mcTrackHe.vz()};
hypCand.gMom = std::array<float, 3>{heMother.px(), heMother.py(), heMother.pz()};
hypCand.gMomHe3 = std::array<float, 3>{mcTrackHe.px(), mcTrackHe.py(), mcTrackHe.pz()};
for (int i = 0; i < 3; i++) {

Check failure on line 807 in PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
hypCand.gDecVtx[i] = secVtx[i] - primVtx[i];
}
hypCand.isSignal = true;
Expand Down Expand Up @@ -964,23 +964,26 @@
// now we fill only the signal candidates that were not reconstructed
for (const auto& mcPart : particlesMC) {

if (std::abs(mcPart.pdgCode()) != hyperPdg)
if (std::abs(mcPart.pdgCode()) != hyperPdg) {
continue;
std::array<float, 3> secVtx;
}
std::array<float, 3> secVtx{0.f, 0.f, 0.f};
std::array<float, 3> lastDaugVtx{0.f, 0.f, 0.f};
std::array<float, 3> primVtx = {mcPart.vx(), mcPart.vy(), mcPart.vz()};
std::array<float, 3> momMother = {mcPart.px(), mcPart.py(), mcPart.pz()};
std::array<float, 3> momHe3;
std::array<float, 3> momHe3{0.f, 0.f, 0.f};
bool isHeFound = false;
int mcProcess = {0};
for (const auto& mcDaught : mcPart.daughters_as<aod::McParticles>()) {
if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons
lastDaugVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()};
mcProcess = mcDaught.getProcess();
}
if (std::abs(mcDaught.pdgCode()) == heDauPdg) {
secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()};
secVtx = lastDaugVtx;
momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()};
isHeFound = true;
}
if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons
mcProcess = mcDaught.getProcess();
}
}
if (mcPart.pdgCode() > 0) {
hIsMatterGen->Fill(0.);
Expand All @@ -1005,7 +1008,7 @@
hypCand.isSurvEvSelection = isSurvEvSelCollision[mcPart.mcCollisionId()];
int chargeFactor = -1 + 2 * (hypCand.pdgCode > 0);
for (int i = 0; i < 3; i++) {
hypCand.gDecVtx[i] = secVtx[i] - primVtx[i];
hypCand.gDecVtx[i] = (isHeFound ? secVtx[i] : lastDaugVtx[i]) - primVtx[i];
hypCand.gMom[i] = momMother[i];
hypCand.gMomHe3[i] = momHe3[i];
}
Expand Down
21 changes: 3 additions & 18 deletions PWGLF/TableProducer/Nuspex/nucleiThreeBodyBuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ struct NucleiThreeBodyBuilder {
std::vector<bool> preselectedTracks;

struct RecoCandidate {
std::array<int, 3> trackIds{InvalidLabel, InvalidLabel, InvalidLabel};
int collisionId = InvalidLabel;
std::array<int8_t, 3> signs{};
float pt = 0.f;
float eta = 0.f;
Expand All @@ -218,10 +216,8 @@ struct NucleiThreeBodyBuilder {
};

struct MCInfo {
std::array<int, 3> labels{InvalidLabel, InvalidLabel, InvalidLabel};
std::array<int, 3> pdgs{};
uint8_t matchStatus = MissingDaughterLabel;
int motherLabel = InvalidLabel;
int motherPdg = 0;
float motherPt = InvalidFloat;
float motherEta = InvalidFloat;
Expand Down Expand Up @@ -472,10 +468,6 @@ struct NucleiThreeBodyBuilder {
}
registry.fill(HIST("triplets"), 1.);

out.trackIds = {static_cast<int>(he3Track.globalIndex()),
static_cast<int>(daughter1Track.globalIndex()),
static_cast<int>(daughter2Track.globalIndex())};
out.collisionId = collision.globalIndex();
out.signs = {static_cast<int8_t>(he3Track.sign() > 0 ? 1 : -1),
static_cast<int8_t>(daughter1Track.sign() > 0 ? 1 : -1),
static_cast<int8_t>(daughter2Track.sign() > 0 ? 1 : -1)};
Expand Down Expand Up @@ -546,8 +538,7 @@ struct NucleiThreeBodyBuilder {

void fillDataTable(RecoCandidate const& c)
{
outputData(c.trackIds[0], c.trackIds[1], c.trackIds[2], c.collisionId,
c.signs[0], c.signs[1], c.signs[2],
outputData(c.signs[0], c.signs[1], c.signs[2],
c.pt, c.eta, c.phi,
c.daughterMomentum[0], c.daughterMomentum[1], c.daughterMomentum[2],
c.chi2, c.dcaDaughters, c.cosPA, c.decayLength,
Expand Down Expand Up @@ -575,9 +566,6 @@ struct NucleiThreeBodyBuilder {
const auto he3Particle = he3Track.template mcParticle_as<aod::McParticles>();
const auto daughter1Particle = daughter1Track.template mcParticle_as<aod::McParticles>();
const auto daughter2Particle = daughter2Track.template mcParticle_as<aod::McParticles>();
info.labels = {static_cast<int>(he3Particle.globalIndex()),
static_cast<int>(daughter1Particle.globalIndex()),
static_cast<int>(daughter2Particle.globalIndex())};
info.pdgs = {he3Particle.pdgCode(), daughter1Particle.pdgCode(), daughter2Particle.pdgCode()};
info.matchStatus = NoCommonImmediateMother;

Expand All @@ -601,7 +589,6 @@ struct NucleiThreeBodyBuilder {

const auto selectedMother = mcParticles.rawIteratorAt(commonMotherLabel);
info.matchStatus = CommonImmediateMother;
info.motherLabel = commonMotherLabel;
info.motherPdg = selectedMother.pdgCode();
const int he3Sign = he3Track.sign() > 0 ? 1 : -1;
const bool expectedDaughters = info.pdgs[0] == he3Sign * He3Pdg &&
Expand All @@ -627,8 +614,7 @@ struct NucleiThreeBodyBuilder {

void fillMCTable(RecoCandidate const& c, MCInfo const& m)
{
outputMC(c.trackIds[0], c.trackIds[1], c.trackIds[2], c.collisionId,
c.signs[0], c.signs[1], c.signs[2],
outputMC(c.signs[0], c.signs[1], c.signs[2],
c.pt, c.eta, c.phi,
c.daughterMomentum[0], c.daughterMomentum[1], c.daughterMomentum[2],
c.chi2, c.dcaDaughters, c.cosPA, c.decayLength,
Expand All @@ -643,9 +629,8 @@ struct NucleiThreeBodyBuilder {
c.tpcNCls[0], c.tpcNCls[1], c.tpcNCls[2],
c.tpcCrossedRows[0], c.tpcCrossedRows[1], c.tpcCrossedRows[2],
c.itsNCls[0], c.itsNCls[1], c.itsNCls[2],
m.labels[0], m.labels[1], m.labels[2],
m.pdgs[0], m.pdgs[1], m.pdgs[2],
m.matchStatus, m.motherLabel, m.motherPdg,
m.matchStatus, m.motherPdg,
m.motherPt, m.motherEta, m.motherPhi, m.decayLength);
}

Expand Down
Loading
Loading