1919#include " PWGLF/DataModel/LFStrangenessTables.h"
2020#include " PWGLF/DataModel/mcCentrality.h"
2121#include " PWGLF/Utils/collisionCuts.h"
22+ #include " PWGLF/Utils/inelGt.h"
2223
2324#include " Common/CCDB/RCTSelectionFlags.h"
2425#include " Common/Core/RecoDecay.h"
26+ #include " Common/Core/TrackSelection.h"
27+ #include " Common/Core/trackUtilities.h"
2528#include " Common/DataModel/Centrality.h"
2629#include " Common/DataModel/EventSelection.h"
2730#include " Common/DataModel/Multiplicity.h"
2831#include " Common/DataModel/PIDResponseTOF.h"
2932#include " Common/DataModel/PIDResponseTPC.h"
3033#include " Common/DataModel/TrackSelectionTables.h"
3134
32- #include < CCDB/BasicCCDBManager.h>
33- #include < CCDB/CcdbApi.h>
34- #include < CommonConstants/MathConstants.h>
35- #include < CommonConstants/PhysicsConstants.h>
36- #include < Framework/ASoAHelpers.h>
37- #include < Framework/AnalysisDataModel.h>
38- #include < Framework/AnalysisHelpers.h>
39- #include < Framework/AnalysisTask.h>
40- #include < Framework/BinningPolicy.h>
41- #include < Framework/Configurable.h>
42- #include < Framework/GroupedCombinations.h>
43- #include < Framework/HistogramRegistry.h>
44- #include < Framework/HistogramSpec.h>
45- #include < Framework/InitContext.h>
46- #include < Framework/O2DatabasePDGPlugin.h>
47- #include < Framework/OutputObjHeader.h>
48- #include < Framework/runDataProcessing.h>
49-
50- #include < Math/GenVector/Boost.h>
51- #include < Math/Vector3Dfwd.h>
52- #include < Math/Vector4D.h> // IWYU pragma: keep (do not replace with Math/Vector4Dfwd.h)
53- #include < Math/Vector4Dfwd.h>
54- #include < TF1.h>
35+ #include " CCDB/BasicCCDBManager.h"
36+ #include " CCDB/CcdbApi.h"
37+ #include " CommonConstants/PhysicsConstants.h"
38+ #include " DCAFitter/DCAFitterN.h"
39+ #include " DataFormatsParameters/GRPMagField.h"
40+ #include " DataFormatsParameters/GRPObject.h"
41+ #include " Framework/ASoAHelpers.h"
42+ #include " Framework/AnalysisDataModel.h"
43+ #include " Framework/AnalysisTask.h"
44+ #include " Framework/HistogramRegistry.h"
45+ #include " Framework/O2DatabasePDGPlugin.h"
46+ #include " Framework/StaticFor.h"
47+ #include " Framework/StepTHn.h"
48+ #include " Framework/runDataProcessing.h"
49+ #include " ReconstructionDataFormats/Track.h"
50+
51+ #include " Math/GenVector/Boost.h"
52+ #include " Math/Vector3D.h"
53+ #include " Math/Vector4D.h"
54+ #include " TF1.h"
55+ #include " TRandom3.h"
56+ #include " TVector2.h"
57+ // #include <TDatabasePDG.h> // FIXME
58+ #include < TDirectory.h>
59+ #include < TFile.h>
60+ #include < TH1D.h>
61+ #include < TH1F.h>
62+ #include < TH2F.h>
5563#include < THn.h>
64+ #include < TMath.h>
65+ #include < TObjArray.h>
5666#include < TPDGCode.h> // FIXME
57- #include < TRandom3.h>
5867
5968#include < array>
6069#include < chrono>
6170#include < cmath>
62- #include < cstdint>
6371#include < cstdlib>
6472#include < string>
6573#include < unordered_map>
@@ -344,7 +352,6 @@ struct Chargedkstaranalysis {
344352 AxisSpec thnAxisPhi = {axisCfgs.configThnAxisPhi , " Configurabel phi axis" }; // 0 to 2pi
345353 // THnSparse
346354 AxisSpec mcLabelAxis = {5 , -0.5 , 4.5 , " MC Label" };
347-
348355 if (!doprocessMC) {
349356 histos.add (" hEvtSelInfo" , " hEvtSelInfo" , kTH1F , {{5 , 0 , 5.0 }});
350357 auto hCutFlow = histos.get <TH1>(HIST (" hEvtSelInfo" ));
@@ -402,7 +409,7 @@ struct Chargedkstaranalysis {
402409 hK0sCut->GetXaxis ()->SetBinLabel (iK0sbin++, " cross-mass veto" );
403410
404411 histos.add (" QA/before/CentDist" , " Centrality distribution" , {HistType::kTH1D , {centAxis}});
405- histos.add (" QA/before/CentDist1" , " Centrality distribution" , HistType ::kTH1F , {{110 , 0 , 110 }});
412+ histos.add (" QA/before/CentDist1" , " Centrality distribution" , o2::framework ::kTH1F , {{110 , 0 , 110 }});
406413
407414 histos.add (" QA/trkbpionTPCPIDME" , " TPC PID of bachelor pion candidates" , HistType::kTH2D , {ptAxisQA, pidQAAxis});
408415
@@ -744,88 +751,7 @@ struct Chargedkstaranalysis {
744751
745752 return returnFlag;
746753 }
747- template <typename TrackTemplate, typename V0Template>
748- bool isTrueKstar (const TrackTemplate& bTrack, const V0Template& K0scand)
749- {
750- if (std::abs (bTrack.PDGCode ()) != kPiPlus ) // Are you pion?
751- return false ;
752- if (std::abs (K0scand.PDGCode ()) != kPDGK0s ) // Are you K0s?
753- return false ;
754-
755- auto motherbTrack = bTrack.template mothers_as <aod::McParticles>();
756- auto motherkV0 = K0scand.template mothers_as <aod::McParticles>();
757-
758- // Check bTrack first
759- if (std::abs (motherbTrack.pdgCode ()) != kKstarPlus ) // Are you charged Kstar's daughter?
760- return false ; // Apply first since it's more restrictive
761-
762- if (std::abs (motherkV0.pdgCode ()) != kPDGK0 ) // Is it K0s?
763- return false ;
764- // Check if K0s's mother is K0 (311)
765- auto motherK0 = motherkV0.template mothers_as <aod::McParticles>();
766- if (std::abs (motherK0.pdgCode ()) != kPDGK0 )
767- return false ;
768-
769- // Check if K0's mother is Kstar (323)
770- auto motherKstar = motherK0.template mothers_as <aod::McParticles>();
771- if (std::abs (motherKstar.pdgCode ()) != kKstarPlus )
772- return false ;
773-
774- // Check if bTrack and K0 have the same mother (global index)
775- if (motherbTrack.globalIndex () != motherK0.globalIndex ())
776- return false ;
777-
778- return true ;
779- }
780-
781754 int count = 0 ;
782- template <typename V0T, typename TrkT>
783- bool matchRecoToTruthKstar (V0T const & v0, TrkT const & trk)
784- {
785- if (!v0.has_mcParticle () || !trk.has_mcParticle ())
786- return false ;
787-
788- auto mcK0s = v0.template mcParticle_as <MCTrueTrackCandidates>();
789- auto mcPi = trk.template mcParticle_as <MCTrueTrackCandidates>();
790-
791- if (std::abs (mcK0s.pdgCode ()) != kPDGK0s )
792- return false ;
793- if (std::abs (mcPi.pdgCode ()) != kPiPlus )
794- return false ;
795-
796- MCTrueTrackCandidates::iterator kstarFromPi;
797- bool havePiKstar = false ;
798- for (const auto & m1 : mcPi.template mothers_as <MCTrueTrackCandidates>()) {
799- if (std::abs (m1.pdgCode ()) == kKstarPlus ) {
800- kstarFromPi = m1;
801- havePiKstar = true ;
802- break ;
803- }
804- }
805- if (!havePiKstar) {
806- return false ;
807- }
808-
809- bool shareSameKstar = false ;
810- for (const auto & m1 : mcK0s.template mothers_as <MCTrueTrackCandidates>()) {
811- if (std::abs (m1.pdgCode ()) == kPDGK0 ) {
812- for (const auto & m2 : m1.template mothers_as <MCTrueTrackCandidates>()) {
813- if (m2.globalIndex () == kstarFromPi.globalIndex ()) {
814- shareSameKstar = true ;
815- break ;
816- }
817- }
818- if (shareSameKstar)
819- break ;
820- }
821- }
822- if (!shareSameKstar) {
823- return false ;
824- }
825-
826- return true ;
827- } // matchRecoToTruthKstar
828-
829755 template <typename T>
830756 void fillKstarHist (bool isRot, float multiplicity, const T& mother, double cosTheta)
831757 {
@@ -1313,7 +1239,6 @@ struct Chargedkstaranalysis {
13131239 histos.fill (HIST (" QA/MC/QACent_woCut" ), lCentrality);
13141240 histos.fill (HIST (" QA/MC/QAvtxz_woCut" ), coll.posZ ());
13151241 }
1316-
13171242 if (!colCuts.isSelected (coll))
13181243 continue ;
13191244 if (rctCut.requireRCTFlagChecker && !rctCut.rctChecker (coll))
@@ -1408,9 +1333,7 @@ struct Chargedkstaranalysis {
14081333
14091334 if (!coll.has_mcCollision ())
14101335 continue ;
1411-
14121336 const auto mcid = coll.mcCollisionId ();
1413-
14141337 if (allowedMcIds.count (mcid) == 0 )
14151338 continue ; // To check the event is allowed or not
14161339
@@ -1427,7 +1350,6 @@ struct Chargedkstaranalysis {
14271350 }
14281351 if (!selectionK0s (coll, v0))
14291352 continue ;
1430-
14311353 auto trks = tracks.sliceBy (perCollision, v0.collisionId ()); // Grouping the tracks with the v0s, means only those tracks that belong to the same collision as v0
14321354 for (const auto & bTrack : trks) {
14331355 if (bTrack.collisionId () != v0.collisionId ())
@@ -1436,7 +1358,6 @@ struct Chargedkstaranalysis {
14361358 continue ;
14371359 if (!selectionPIDPion (bTrack))
14381360 continue ;
1439-
14401361 LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot;
14411362
14421363 lResoSecondary = LorentzVectorSetXYZM (v0.px (), v0.py (), v0.pz (), MassK0Short);
@@ -1447,7 +1368,6 @@ struct Chargedkstaranalysis {
14471368 const double yreco = lResoKstar.Rapidity ();
14481369 if (std::abs (yreco) > kstarCutCfgs.cKstarMaxRap )
14491370 continue ;
1450-
14511371 // Since we are doing the MC study and we know about the PDG code of each particle let's try to check the things which we have
14521372 if (!v0.has_mcParticle () || !bTrack.has_mcParticle ())
14531373 continue ;
@@ -1470,6 +1390,27 @@ struct Chargedkstaranalysis {
14701390 if (!havePiKstar) {
14711391 continue ;
14721392 }
1393+ // Loops over all the mother's of K0s and check if this K0s comming from a kstar and also share the smae mother as of the pion
1394+ double ptgen = 0 , ygen = 0 ;
1395+ bool shareSameKstar = false ;
1396+ for (const auto & m1 : mcK0s.template mothers_as <MCTrueTrackCandidates>()) {
1397+ if (std::abs (m1.pdgCode ()) == kPDGK0 ) {
1398+ for (const auto & m2 : m1.template mothers_as <MCTrueTrackCandidates>()) {
1399+ if (m2.globalIndex () == kstarFromPi.globalIndex ()) {
1400+ shareSameKstar = true ;
1401+ break ;
1402+ }
1403+ }
1404+ if (shareSameKstar)
1405+ break ;
1406+ }
1407+ }
1408+ if (!shareSameKstar) {
1409+ continue ;
1410+ }
1411+ ptgen = kstarFromPi.pt ();
1412+ ygen = kstarFromPi.y ();
1413+
14731414 histos.fill (HIST (" EffKstar/recoKstar" ), ptreco, lCentrality);
14741415 if (helicityCfgs.cBoostKShot ) {
14751416 fillInvMass (lResoKstar, lCentrality, lResoSecondary, lDecayDaughter_bach, eventCutCfgs.confIsMix );
0 commit comments