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,18 +45,24 @@ 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+ }
5363 }
5464
55- void process (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision,
56- aod::KinkCands const & KinkCands, TracksFull const &)
65+ void processData (CollisionsFull::iterator const & collision, aod::KinkCands const & KinkCands, TracksFull const &)
5766 {
5867 if (std::abs (collision.posZ ()) > cutzvertex || !collision.sel8 ()) {
5968 return ;
@@ -65,9 +74,54 @@ struct sigmaminustask {
6574 continue ;
6675 }
6776 rSigmaMinus.fill (HIST (" h2MassSigmaMinusPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), kinkCand.mSigmaMinus ());
77+ rSigmaMinus.fill (HIST (" h2SigmaMassVsXiMass" ), kinkCand.mXiMinus (), kinkCand.mSigmaMinus ());
6878 rSigmaMinus.fill (HIST (" h2NSigmaPiPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), dauTrack.tpcNSigmaPi ());
6979 }
7080 }
81+ PROCESS_SWITCH (sigmaminustask, processData, " Data processing" , true );
82+
83+ void processMC (CollisionsFullMC::iterator const & collision, aod::KinkCands const & KinkCands, aod::McTrackLabels const & trackLabelsMC, aod::McParticles const &, TracksFull const &)
84+ {
85+ if (std::abs (collision.posZ ()) > cutzvertex || !collision.sel8 ()) {
86+ return ;
87+ }
88+ rEventSelection.fill (HIST (" hVertexZRec" ), collision.posZ ());
89+ for (const auto & kinkCand : KinkCands) {
90+ 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+ }
96+ if (abs (dauTrack.tpcNSigmaPi ()) > cutNSigmaPi) {
97+ continue ;
98+ }
99+
100+ rSigmaMinus.fill (HIST (" h2MassSigmaMinusPt" ), kinkCand.mothSign () * kinkCand.ptMoth (), kinkCand.mSigmaMinus ());
101+ rSigmaMinus.fill (HIST (" h2SigmaMassVsXiMass" ), kinkCand.mXiMinus (), kinkCand.mSigmaMinus ());
102+ 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+ }
123+ }
124+ PROCESS_SWITCH (sigmaminustask, processMC, " MC processing" , false );
71125};
72126
73127WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments