Skip to content

Commit dbac26b

Browse files
authored
[PWGLF] feat(hypernuclei): Add process code for MC analysis (#13459)
1 parent 67f45b1 commit dbac26b

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

PWGLF/DataModel/LFHypernucleiTables.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ DECLARE_SOA_TABLE(MCHypCands, "AOD", "MCHYPCANDS",
150150
hyperrec::IsSignal,
151151
hyperrec::IsRecoMCCollision,
152152
hyperrec::IsSurvEvSel,
153-
hyperrec::IsTwoBodyDecay);
153+
hyperrec::IsTwoBodyDecay, aod::mcparticle::StatusCode);
154154

155155
DECLARE_SOA_TABLE(DataHypCandsWColl, "AOD", "HYPCANDSWCOLL",
156156
o2::soa::Index<>,

PWGLF/TableProducer/Nuspex/hyperRecoTask.cxx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
using namespace o2;
4949
using namespace o2::framework;
5050
using namespace o2::framework::expressions;
51-
using std::array;
5251
using CollBracket = o2::math_utils::Bracket<int>;
5352
using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::TOFSignal, aod::TOFEvTime>;
5453
using CollisionsFull = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms>;
@@ -166,7 +165,7 @@ struct hyperRecoTask {
166165

167166
// Define o2 fitter, 2-prong, active memory (no need to redefine per event)
168167
o2::vertexing::DCAFitterN<2> fitter;
169-
svPoolCreator svCreator{heDauPdg, 211};
168+
svPoolCreator svCreator{heDauPdg, PDG_t::kPiPlus};
170169

171170
// daughter masses
172171
float he3Mass = o2::constants::physics::MassHelium3;
@@ -552,7 +551,7 @@ struct hyperRecoTask {
552551
if (mBBparamsHe[5] < 0) {
553552
LOG(fatal) << "Bethe-Bloch parameters for He3 not set, please check your CCDB and configuration";
554553
}
555-
for (auto& v0 : V0s) {
554+
for (const auto& v0 : V0s) {
556555
// if(v0.isStandardV0())
557556
// continue;
558557
auto posTrack = tracks.rawIteratorAt(v0.posTrackId());
@@ -593,7 +592,7 @@ struct hyperRecoTask {
593592
svCreator.clearPools();
594593
svCreator.fillBC2Coll(collisions, bcs);
595594

596-
for (auto& track : tracks) {
595+
for (const auto& track : tracks) {
597596

598597
if (std::abs(track.eta()) > etaMax)
599598
continue;
@@ -603,7 +602,7 @@ struct hyperRecoTask {
603602

604603
auto nSigmaHe = computeNSigmaHe3(track);
605604
bool isHe = nSigmaHe > -1 * nSigmaMaxHe;
606-
int pdgHypo = isHe ? heDauPdg : 211;
605+
int pdgHypo = isHe ? heDauPdg : PDG_t::kPiPlus;
607606
// LOG(info) << "ncls found: " << track.tpcNClsFound();
608607
if (isHe && track.tpcNClsFound() < nTPCClusMinHe)
609608
continue;
@@ -615,7 +614,7 @@ struct hyperRecoTask {
615614
auto& svPool = svCreator.getSVCandPool(collisions);
616615
LOG(debug) << "SV pool size: " << svPool.size();
617616

618-
for (auto& svCand : svPool) {
617+
for (const auto& svCand : svPool) {
619618
auto heTrack = tracks.rawIteratorAt(svCand.tr0Idx);
620619
auto piTrack = tracks.rawIteratorAt(svCand.tr1Idx);
621620
auto collIdxs = svCand.collBracket;
@@ -634,19 +633,19 @@ struct hyperRecoTask {
634633
auto mcTrackHe = mcLabHe.mcParticle_as<aod::McParticles>();
635634
auto mcTrackPi = mcLabPi.mcParticle_as<aod::McParticles>();
636635
if (mcTrackHe.has_mothers() && mcTrackPi.has_mothers()) {
637-
for (auto& heMother : mcTrackHe.mothers_as<aod::McParticles>()) {
638-
for (auto& piMother : mcTrackPi.mothers_as<aod::McParticles>()) {
636+
for (const auto& heMother : mcTrackHe.mothers_as<aod::McParticles>()) {
637+
for (const auto& piMother : mcTrackPi.mothers_as<aod::McParticles>()) {
639638
if (heMother.globalIndex() != piMother.globalIndex())
640639
continue;
641-
if (std::abs(mcTrackHe.pdgCode()) != heDauPdg || std::abs(mcTrackPi.pdgCode()) != 211)
640+
if (std::abs(mcTrackHe.pdgCode()) != heDauPdg || std::abs(mcTrackPi.pdgCode()) != PDG_t::kPiPlus)
642641
continue;
643642
if (std::abs(heMother.pdgCode()) != hyperPdg)
644643
continue;
645644

646-
auto primVtx = array{heMother.vx(), heMother.vy(), heMother.vz()};
647-
auto secVtx = array{mcTrackHe.vx(), mcTrackHe.vy(), mcTrackHe.vz()};
648-
hypCand.gMom = array{heMother.px(), heMother.py(), heMother.pz()};
649-
hypCand.gMomHe3 = array{mcTrackHe.px(), mcTrackHe.py(), mcTrackHe.pz()};
645+
auto primVtx = std::array<float, 3>{heMother.vx(), heMother.vy(), heMother.vz()};
646+
auto secVtx = std::array<float, 3>{mcTrackHe.vx(), mcTrackHe.vy(), mcTrackHe.vz()};
647+
hypCand.gMom = std::array<float, 3>{heMother.px(), heMother.py(), heMother.pz()};
648+
hypCand.gMomHe3 = std::array<float, 3>{mcTrackHe.px(), mcTrackHe.py(), mcTrackHe.pz()};
650649
for (int i = 0; i < 3; i++) {
651650
hypCand.gDecVtx[i] = secVtx[i] - primVtx[i];
652651
}
@@ -683,7 +682,7 @@ struct hyperRecoTask {
683682
selectGoodCollisions(collisions);
684683
useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s);
685684

686-
for (auto& hypCand : hyperCandidates) {
685+
for (const auto& hypCand : hyperCandidates) {
687686
auto collision = collisions.rawIteratorAt(hypCand.collisionID);
688687
float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0;
689688
outputDataTable(collision.centFT0A(), collision.centFT0C(), collision.centFT0M(),
@@ -712,7 +711,7 @@ struct hyperRecoTask {
712711
selectGoodCollisions(collisions);
713712
useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s);
714713

715-
for (auto& hypCand : hyperCandidates) {
714+
for (const auto& hypCand : hyperCandidates) {
716715
auto collision = collisions.rawIteratorAt(hypCand.collisionID);
717716
if (isEventUsedForEPCalibration && !collision.triggereventep()) {
718717
return;
@@ -746,7 +745,7 @@ struct hyperRecoTask {
746745
selectGoodCollisions(collisions);
747746
useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s);
748747

749-
for (auto& hypCand : hyperCandidates) {
748+
for (const auto& hypCand : hyperCandidates) {
750749
auto collision = collisions.rawIteratorAt(hypCand.collisionID);
751750
float trackedHypClSize = !trackedClSize.empty() ? trackedClSize[hypCand.v0ID] : 0;
752751
outputDataTableWithCollID(hypCand.collisionID, collision.centFT0A(), collision.centFT0C(), collision.centFT0M(),
@@ -779,7 +778,7 @@ struct hyperRecoTask {
779778
selectGoodCollisionsMC(collisions);
780779
useCustomVertexer ? fillCustomV0s(collisions, tracks, ambiTracks, bcs) : fillV0s(collisions, tracks, V0s);
781780
fillMCinfo(trackLabelsMC, particlesMC);
782-
for (auto& hypCand : hyperCandidates) {
781+
for (const auto& hypCand : hyperCandidates) {
783782
auto collision = collisions.rawIteratorAt(hypCand.collisionID);
784783
if (!hypCand.isSignal && mcSignalOnly)
785784
continue;
@@ -798,11 +797,11 @@ struct hyperRecoTask {
798797
hypCand.clusterSizeITSHe3, hypCand.clusterSizeITSPi, hypCand.flags, trackedHypClSize,
799798
chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(),
800799
hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2],
801-
hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, 1);
800+
hypCand.isReco, hypCand.isFakeHeOnITSLayer, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, 1, 0);
802801
}
803802

804803
// now we fill only the signal candidates that were not reconstructed
805-
for (auto& mcPart : particlesMC) {
804+
for (const auto& mcPart : particlesMC) {
806805

807806
if (std::abs(mcPart.pdgCode()) != hyperPdg)
808807
continue;
@@ -811,12 +810,15 @@ struct hyperRecoTask {
811810
std::array<float, 3> momMother = {mcPart.px(), mcPart.py(), mcPart.pz()};
812811
std::array<float, 3> momHe3;
813812
bool isHeFound = false;
814-
for (auto& mcDaught : mcPart.daughters_as<aod::McParticles>()) {
813+
int mcProcess = {0};
814+
for (const auto& mcDaught : mcPart.daughters_as<aod::McParticles>()) {
815815
if (std::abs(mcDaught.pdgCode()) == heDauPdg) {
816816
secVtx = {mcDaught.vx(), mcDaught.vy(), mcDaught.vz()};
817817
momHe3 = {mcDaught.px(), mcDaught.py(), mcDaught.pz()};
818818
isHeFound = true;
819-
break;
819+
}
820+
if (mcDaught.pdgCode() != PDG_t::kElectron) { // we do not care about delta electrons
821+
mcProcess = mcDaught.getProcess();
820822
}
821823
}
822824
if (mcPart.pdgCode() > 0) {
@@ -870,7 +872,7 @@ struct hyperRecoTask {
870872
-1, -1, -1, false,
871873
chargeFactor * hypCand.genPt(), hypCand.genPhi(), hypCand.genEta(), hypCand.genPtHe3(),
872874
hypCand.gDecVtx[0], hypCand.gDecVtx[1], hypCand.gDecVtx[2],
873-
hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, isHeFound);
875+
hypCand.isReco, -1, hypCand.isSignal, hypCand.isRecoMCCollision, hypCand.isSurvEvSelection, isHeFound, mcProcess);
874876
}
875877
}
876878
PROCESS_SWITCH(hyperRecoTask, processMC, "MC analysis", false);

0 commit comments

Comments
 (0)