|
16 | 16 | #include "MetadataHelper.h" |
17 | 17 |
|
18 | 18 | #include "PWGLF/DataModel/LFHypernucleiKfTables.h" |
| 19 | +#include "PWGLF/DataModel/LFNucleiTables.h" |
| 20 | +#include "PWGLF/DataModel/LFPIDTOFGenericTables.h" |
| 21 | +#include "PWGLF/DataModel/LFParticleIdentification.h" |
| 22 | +#include "PWGLF/Utils/pidTOFGeneric.h" |
19 | 23 |
|
20 | 24 | #include "Common/Core/RecoDecay.h" |
21 | 25 | #include "Common/Core/trackUtilities.h" |
@@ -65,7 +69,7 @@ using namespace o2::framework::expressions; |
65 | 69 |
|
66 | 70 | using CollisionsFull = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms, aod::CentFV0As>; |
67 | 71 | using CollisionsFullMC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms, aod::CentFV0As>; |
68 | | -using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::pidTOFmass, aod::pidTPCFullPr, aod::pidTPCFullPi>; |
| 72 | +using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::TOFSignal, o2::aod::EvTimeTOFFT0ForTrack, aod::pidTPCFullPr, aod::pidTPCFullPi>; |
69 | 73 |
|
70 | 74 | o2::common::core::MetadataHelper metadataInfo; // Metadata helper |
71 | 75 | //---------------------------------------------------------------------------------------------------------------- |
@@ -146,17 +150,17 @@ enum HYPNUCDEFS { kEnabled, |
146 | 150 | kDsigns, |
147 | 151 | kUseV0for }; |
148 | 152 | static const std::vector<std::string> hypNucDefsLb{"Enabled", "PDGCode", "d1", "d2", "d3", "d4", "daughterSigns", "useV0for"}; |
149 | | -static const std::string hypNucDefs[nHyperNuclei][nHypNucDefs]{ |
150 | | - {"0", "3122", "proton", "pion", "none", "none", "+-", ""}, |
151 | | - {"0", "1010010030", "helion", "pion", "none", "none", "+-", ""}, |
152 | | - {"0", "1010010030", "deuteron", "proton", "pion", "none", "++-", ""}, |
153 | | - {"0", "1010010040", "alpha", "pion", "none", "none", "+-", ""}, |
154 | | - {"0", "1010010040", "triton", "proton", "pion", "none", "++-", ""}, |
155 | | - {"0", "1010020040", "helion", "proton", "pion", "none", "++-", ""}, |
156 | | - {"0", "1010020050", "alpha", "proton", "pion", "none", "++-", ""}, |
157 | | - {"0", "1010020050", "helion", "deuteron", "pion", "none", "++-", ""}, |
158 | | - {"0", "0", "none", "none", "none", "none", "", ""}, |
159 | | - {"0", "0", "none", "none", "none", "none", "", ""}}; // NOLINT: runtime/string |
| 153 | +const std::string hypNucDefs[nHyperNuclei][nHypNucDefs]{// NOLINT: runtime/string |
| 154 | + {"0", "3122", "proton", "pion", "none", "none", "+-", ""}, |
| 155 | + {"0", "1010010030", "helion", "pion", "none", "none", "+-", ""}, |
| 156 | + {"0", "1010010030", "deuteron", "proton", "pion", "none", "++-", ""}, |
| 157 | + {"0", "1010010040", "alpha", "pion", "none", "none", "+-", ""}, |
| 158 | + {"0", "1010010040", "triton", "proton", "pion", "none", "++-", ""}, |
| 159 | + {"0", "1010020040", "helion", "proton", "pion", "none", "++-", ""}, |
| 160 | + {"0", "1010020050", "alpha", "proton", "pion", "none", "++-", ""}, |
| 161 | + {"0", "1010020050", "helion", "deuteron", "pion", "none", "++-", ""}, |
| 162 | + {"0", "0", "none", "none", "none", "none", "", ""}, |
| 163 | + {"0", "0", "none", "none", "none", "none", "", ""}}; |
160 | 164 |
|
161 | 165 | const int nSelPrim = 8; |
162 | 166 | enum PRESELECTIONSPRIMARIES { kMinMass, |
@@ -263,7 +267,6 @@ struct DaughterKf { |
263 | 267 | dcaToPv = daughterKfp.GetDistanceFromVertex(&vtx[0]); |
264 | 268 | dcaToPvZ = std::sqrt(dcaToPv * dcaToPv - dcaToPvXY * dcaToPvXY); |
265 | 269 | } |
266 | | - |
267 | 270 | bool isTrack() { return daughterTrackId >= 0; } |
268 | 271 | }; |
269 | 272 | int DaughterKf::uniqueId = 0; |
@@ -429,6 +432,30 @@ struct IndexPairs { |
429 | 432 | } |
430 | 433 | }; // struct IndexPairs |
431 | 434 |
|
| 435 | +struct IndexPairsVec { |
| 436 | + std::vector<std::vector<std::pair<int64_t, int>>> pairs; |
| 437 | + IndexPairsVec() |
| 438 | + { |
| 439 | + pairs.resize(nDaughterParticles); |
| 440 | + } |
| 441 | + void add(int i, int64_t a, int b) { pairs.at(i).push_back({a, b}); } |
| 442 | + void clear() |
| 443 | + { |
| 444 | + for (size_t i = 0; i < nDaughterParticles; i++) |
| 445 | + pairs.at(i).clear(); |
| 446 | + } |
| 447 | + bool getIndex(int i, int64_t a, int& b) |
| 448 | + { |
| 449 | + for (const auto& pair : pairs.at(i)) { |
| 450 | + if (pair.first == a) { |
| 451 | + b = pair.second; |
| 452 | + return true; |
| 453 | + } |
| 454 | + } |
| 455 | + return false; |
| 456 | + } |
| 457 | +}; // struct IndexPairsVec |
| 458 | + |
432 | 459 | struct McCollInfo { |
433 | 460 | bool hasRecoColl; |
434 | 461 | bool passedEvSel; |
@@ -526,7 +553,8 @@ struct HypKfRecoTask { |
526 | 553 | std::vector<HyperNucleus> singleHyperNuclei, cascadeHyperNuclei; |
527 | 554 | std::vector<float> primVtx, cents; |
528 | 555 | std::vector<McCollInfo> mcCollInfos; |
529 | | - IndexPairs trackIndices, mcPartIndices; |
| 556 | + IndexPairsVec trackIndices; |
| 557 | + IndexPairs mcPartIndices; |
530 | 558 | KFPVertex kfPrimVtx; |
531 | 559 | bool collHasCandidate, collHasMcTrueCandidate, collPassedEvSel, activeCascade, isMC; |
532 | 560 | int64_t mcCollTableIndex; |
@@ -610,8 +638,12 @@ struct HypKfRecoTask { |
610 | 638 | const float itsNsigma = getITSnSigma(track, daughterParticles.at(i)); |
611 | 639 | if (daughterParticles.at(i).trkSettings[kMaxITSnSigma] >= 0 && std::abs(itsNsigma) > daughterParticles.at(i).trkSettings[kMaxITSnSigma]) |
612 | 640 | continue; |
| 641 | + float tpcNsigmaNlp = NoVal; |
| 642 | + if (daughterParticles.at(i).name == "alpha") { |
| 643 | + tpcNsigmaNlp = getTPCnSigma(track, daughterParticles.at(i - 1)); |
| 644 | + } |
613 | 645 | filldedx(track, i); |
614 | | - foundDaughterKfs.at(i).push_back(DaughterKf(i, track.globalIndex(), track.sign(), primVtx, 0, 0, 0)); |
| 646 | + foundDaughterKfs.at(i).push_back(DaughterKf(i, track.globalIndex(), track.sign(), primVtx, tpcNsigma, tpcNsigmaNlp, itsNsigma)); |
615 | 647 | } |
616 | 648 | } // track loop |
617 | 649 | } |
@@ -865,14 +897,14 @@ struct HypKfRecoTask { |
865 | 897 | continue; |
866 | 898 | const auto& daughterTrackId = daughter->daughterTrackId; |
867 | 899 | int trackTableId; |
868 | | - if (!trackIndices.getIndex(daughterTrackId, trackTableId)) { |
| 900 | + if (!trackIndices.getIndex(daughter->species, daughterTrackId, trackTableId)) { |
869 | 901 | const auto& track = tracks.rawIteratorAt(daughterTrackId); |
870 | 902 | outputTrackTable( |
871 | 903 | daughter->species * track.sign(), track.pt(), track.eta(), track.phi(), daughter->dcaToPvXY, daughter->dcaToPvZ, track.tpcNClsFound(), track.tpcChi2NCl(), |
872 | 904 | track.itsClusterSizes(), track.itsChi2NCl(), getRigidity(track), track.tpcSignal(), daughter->tpcNsigma, daughter->tpcNsigmaNHP, daughter->tpcNsigmaNLP, |
873 | | - track.mass(), track.isPVContributor()); |
| 905 | + getMass2(track), track.isPVContributor()); |
874 | 906 | trackTableId = outputTrackTable.lastIndex(); |
875 | | - trackIndices.add(daughterTrackId, trackTableId); |
| 907 | + trackIndices.add(daughter->species, daughterTrackId, trackTableId); |
876 | 908 | } |
877 | 909 | vecDaugtherTracks.push_back(trackTableId); |
878 | 910 | } |
@@ -1162,7 +1194,7 @@ struct HypKfRecoTask { |
1162 | 1194 | return false; |
1163 | 1195 | if (getMeanItsClsSize(track) > particle.trkSettings[kMaxITSmeanClsSize]) |
1164 | 1196 | return false; |
1165 | | - if (particle.trkSettings[kTOFrequiredabove] >= 0 && getRigidity(track) > particle.trkSettings[kTOFrequiredabove] && (track.mass() < particle.trkSettings[kMinTOFmass] || track.mass() > particle.trkSettings[kMaxTOFmass])) |
| 1197 | + if (particle.trkSettings[kTOFrequiredabove] >= 0 && getRigidity(track) > particle.trkSettings[kTOFrequiredabove] && (getMass2(track) < particle.trkSettings[kMinTOFmass] || getMass2(track) > particle.trkSettings[kMaxTOFmass])) |
1166 | 1198 | return false; |
1167 | 1199 | return true; |
1168 | 1200 | } |
@@ -1331,6 +1363,23 @@ struct HypKfRecoTask { |
1331 | 1363 | return -1; |
1332 | 1364 | } |
1333 | 1365 | //---------------------------------------------------------------------------------------------------------------- |
| 1366 | + template <class T> |
| 1367 | + float getMass2(const T& track) |
| 1368 | + { |
| 1369 | + const float p = track.p(); |
| 1370 | + const float& tofStartTime = track.evTimeForTrack(); |
| 1371 | + const float& tofTime = track.tofSignal(); |
| 1372 | + constexpr float CInCmPs = 2.99792458e-2f; |
| 1373 | + const float& length = track.length(); |
| 1374 | + const float time = tofTime - tofStartTime; |
| 1375 | + if (time > 0.f && length > 0.f) { |
| 1376 | + const float beta = length / (CInCmPs * time); |
| 1377 | + const float gamma = 1.f / std::sqrt(1.f - beta * beta); |
| 1378 | + const float mass = p / std::sqrt(gamma * gamma - 1.f); |
| 1379 | + return mass * mass; |
| 1380 | + } |
| 1381 | + return -1.f; |
| 1382 | + } |
1334 | 1383 | //---------------------------------------------------------------------------------------------------------------- |
1335 | 1384 | }; |
1336 | 1385 | //---------------------------------------------------------------------------------------------------------------- |
|
0 commit comments