1313// / \brief Example of a simple task for the analysis of the Sigma-minus
1414// / \author Francesco Mazzaschi <francesco.mazzaschi@cern.ch>
1515
16- #include " Framework/runDataProcessing.h"
17- #include " Framework/AnalysisTask.h"
18- #include " Common/DataModel/EventSelection.h"
1916#include " PWGLF/DataModel/LFKinkDecayTables.h"
17+
18+ #include " Common/DataModel/EventSelection.h"
2019#include " Common/DataModel/PIDResponse.h"
20+
21+ #include " Framework/AnalysisTask.h"
22+ #include " Framework/runDataProcessing.h"
2123#include " ReconstructionDataFormats/PID.h"
2224
2325using namespace o2 ;
@@ -26,6 +28,7 @@ using namespace o2::framework::expressions;
2628
2729using TracksFull = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU, aod::pidTPCPi>;
2830using CollisionsFull = soa::Join<aod::Collisions, aod::EvSel>;
31+ using CollisionsFullMC = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
2932
3033struct sigmaminustask {
3134 // Histograms are defined with HistogramRegistry
@@ -42,32 +45,84 @@ struct sigmaminustask {
4245 const AxisSpec ptAxis{50 , -10 , 10 , " #it{p}_{T} (GeV/#it{c})" };
4346 const AxisSpec nSigmaPiAxis{100 , -5 , 5 , " n#sigma_{#pi}" };
4447 const AxisSpec sigmaMassAxis{100 , 1.1 , 1.4 , " m (GeV/#it{c}^{2})" };
48+ const AxisSpec xiMassAxis{100 , 1.2 , 1.6 , " m_{#Xi} (GeV/#it{c}^{2})" };
49+ const AxisSpec pdgAxis{10001 , -5000 , 5000 , " PDG code" };
4550 const AxisSpec vertexZAxis{100 , -15 ., 15 ., " vrtx_{Z} [cm]" };
4651
4752 // Event selection
4853 rEventSelection.add (" hVertexZRec" , " hVertexZRec" , {HistType::kTH1F , {vertexZAxis}});
49-
5054 // Sigma-minus reconstruction
5155 rSigmaMinus.add (" h2MassSigmaMinusPt" , " h2MassSigmaMinusPt" , {HistType::kTH2F , {ptAxis, sigmaMassAxis}});
56+ rSigmaMinus.add (" h2SigmaMassVsXiMass" , " h2SigmaMassVsXiMass" , {HistType::kTH2F , {xiMassAxis, sigmaMassAxis}});
5257 rSigmaMinus.add (" h2NSigmaPiPt" , " h2NSigmaPiPt" , {HistType::kTH2F , {ptAxis, nSigmaPiAxis}});
58+
59+ if (doprocessMC) {
60+ // Add MC histograms if needed
61+ rSigmaMinus.add (" h2MassSigmaMinusPtMC" , " h2MassSigmaMinusPtMC" , {HistType::kTH2F , {ptAxis, sigmaMassAxis}});
62+ }
63+ }
64+
65+ void processData (CollisionsFull::iterator const & collision, aod::KinkCands const & KinkCands, TracksFull const &)
66+ {
67+ if (std::abs (collision.posZ ()) > cutzvertex || !collision.sel8 ()) {
68+ return ;
69+ }
70+ rEventSelection.fill (HIST (" hVertexZRec" ), collision.posZ ());
71+ for (const auto & kinkCand : KinkCands) {
72+ auto dauTrack = kinkCand.trackDaug_as <TracksFull>();
73+ if (abs (dauTrack.tpcNSigmaPi ()) > cutNSigmaPi) {
74+ continue ;
75+ }
76+ rSigmaMinus.fill (HIST (" h2MassSigmaMinusPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), kinkCand.mSigmaMinus ());
77+ rSigmaMinus.fill (HIST (" h2SigmaMassVsXiMass" ), kinkCand.mXiMinus (), kinkCand.mSigmaMinus ());
78+ rSigmaMinus.fill (HIST (" h2NSigmaPiPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), dauTrack.tpcNSigmaPi ());
79+ }
5380 }
81+ PROCESS_SWITCH (sigmaminustask, processData, " Data processing" , true );
5482
55- void process (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision,
56- aod::KinkCands const & KinkCands, TracksFull const &)
83+ void processMC (CollisionsFullMC::iterator const & collision, aod::KinkCands const & KinkCands, aod::McTrackLabels const & trackLabelsMC, aod::McParticles const &, TracksFull const &)
5784 {
5885 if (std::abs (collision.posZ ()) > cutzvertex || !collision.sel8 ()) {
5986 return ;
6087 }
6188 rEventSelection.fill (HIST (" hVertexZRec" ), collision.posZ ());
6289 for (const auto & kinkCand : KinkCands) {
6390 auto dauTrack = kinkCand.trackDaug_as <TracksFull>();
91+ auto mothTrack = kinkCand.trackMoth_as <TracksFull>();
92+ if (dauTrack.sign () != mothTrack.sign ()) {
93+ LOG (info) << " Skipping kink candidate with opposite sign daughter and mother: " << kinkCand.globalIndex ();
94+ continue ; // Skip if the daughter has the opposite sign as the mother
95+ }
6496 if (abs (dauTrack.tpcNSigmaPi ()) > cutNSigmaPi) {
6597 continue ;
6698 }
99+
67100 rSigmaMinus.fill (HIST (" h2MassSigmaMinusPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), kinkCand.mSigmaMinus ());
101+ rSigmaMinus.fill (HIST (" h2SigmaMassVsXiMass" ), kinkCand.mXiMinus (), kinkCand.mSigmaMinus ());
68102 rSigmaMinus.fill (HIST (" h2NSigmaPiPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), dauTrack.tpcNSigmaPi ());
103+ // do MC association
104+ auto mcLabSigma = trackLabelsMC.rawIteratorAt (mothTrack.globalIndex ());
105+ auto mcLabPiDau = trackLabelsMC.rawIteratorAt (dauTrack.globalIndex ());
106+ if (mcLabSigma.has_mcParticle () && mcLabPiDau.has_mcParticle ()) {
107+ auto mcTrackSigma = mcLabSigma.mcParticle_as <aod::McParticles>();
108+ auto mcTrackPiDau = mcLabPiDau.mcParticle_as <aod::McParticles>();
109+ if (!mcTrackPiDau.has_mothers ()) {
110+ continue ;
111+ }
112+ for (auto & piMother : mcTrackPiDau.mothers_as <aod::McParticles>()) {
113+ if (piMother.globalIndex () != mcTrackSigma.globalIndex ()) {
114+ continue ;
115+ }
116+ if (std::abs (mcTrackSigma.pdgCode ()) != 3112 || std::abs (mcTrackPiDau.pdgCode ()) != 211 ) {
117+ continue ;
118+ }
119+ rSigmaMinus.fill (HIST (" h2MassSigmaMinusPtMC" ), kinkCand.mothSign () * kinkCand.ptMoth (), kinkCand.mSigmaMinus ());
120+
121+ }
122+ }
69123 }
70124 }
125+ PROCESS_SWITCH (sigmaminustask, processMC, " MC processing" , false );
71126};
72127
73128WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments