2222
2323#include " Common/DataModel/Centrality.h"
2424#include " Common/DataModel/EventSelection.h"
25+ #include " Common/DataModel/PIDResponseITS.h"
2526
2627#include < Framework/ASoA.h>
2728#include < Framework/AnalysisDataModel.h>
@@ -52,18 +53,83 @@ using namespace o2::hf_centrality;
5253using namespace o2 ::hf_occupancy;
5354using namespace o2 ::hf_evsel;
5455
56+ namespace o2 ::aod
57+ {
58+ namespace full
59+ {
60+ // Candidate kinematics
61+ DECLARE_SOA_COLUMN (M, m, float ); // ! Invariant mass of candidate (GeV/c^2)
62+ DECLARE_SOA_COLUMN (Pt, pt, float ); // ! Transverse momentum of candidate (GeV/c)
63+ DECLARE_SOA_COLUMN (PtProng0, ptProng0, float ); // ! Transverse momentum of prong 0 (GeV/c)
64+ DECLARE_SOA_COLUMN (PtProng1, ptProng1, float ); // ! Transverse momentum of prong 1 (GeV/c)
65+ DECLARE_SOA_COLUMN (PtProng2, ptProng2, float ); // ! Transverse momentum of prong 2 (GeV/c)
66+ DECLARE_SOA_COLUMN (ImpactParameter0, impactParameter0, float ); // ! Impact parameter (DCA to PV) of prong 0 (cm)
67+ DECLARE_SOA_COLUMN (ImpactParameter1, impactParameter1, float ); // ! Impact parameter (DCA to PV) of prong 1 (cm)
68+ DECLARE_SOA_COLUMN (ImpactParameter2, impactParameter2, float ); // ! Impact parameter (DCA to PV) of prong 2 (cm)
69+ DECLARE_SOA_COLUMN (DecayLength, decayLength, float ); // ! Decay length (3D) of candidate (cm)
70+ DECLARE_SOA_COLUMN (DecayLengthXY, decayLengthXY, float ); // ! Decay length in transverse plane (cm)
71+ DECLARE_SOA_COLUMN (Cpa, cpa, float ); // ! Cosine of pointing angle (3D)
72+ DECLARE_SOA_COLUMN (CpaXY, cpaXY, float ); // ! Cosine of pointing angle in XY plane
73+ DECLARE_SOA_COLUMN (NSigmaTpcDe, nSigmaTpcDe, float ); // ! TPC nσ for deuteron hypothesis
74+ DECLARE_SOA_COLUMN (NSigmaTpcKa, nSigmaTpcKa, float ); // ! TPC nσ for kaon hypothesis
75+ DECLARE_SOA_COLUMN (NSigmaTpcPi, nSigmaTpcPi, float ); // ! TPC nσ for pion hypothesis
76+ DECLARE_SOA_COLUMN (NSigmaItsDe, nSigmaItsDe, float ); // ! ITS nσ for deuteron hypothesis
77+ DECLARE_SOA_COLUMN (NSigmaTofDe, nSigmaTofDe, float ); // ! TOF nσ for deuteron hypothesis
78+ DECLARE_SOA_COLUMN (NSigmaTofKa, nSigmaTofKa, float ); // ! TOF nσ for kaon hypothesis
79+ DECLARE_SOA_COLUMN (NSigmaTofPi, nSigmaTofPi, float ); // ! TOF nσ for pion hypothesis
80+ DECLARE_SOA_COLUMN (NItsClusters, nItsClusters, int8_t ); // ! Number of ITS clusters used in the track fit
81+ DECLARE_SOA_COLUMN (NItsNClusterSize, nItsNClusterSize, int8_t ); // ! Number of ITS clusters size used in the track fit
82+ DECLARE_SOA_COLUMN (NTpcClusters, nTpcClusters, int8_t ); // ! Number of TPC clusters used in the track fit
83+ DECLARE_SOA_COLUMN (NTpcSignalsDe, nTpcSignalsDe, int8_t ); // ! Number of TPC signas
84+ DECLARE_SOA_COLUMN (NItsSignalsDe, nItsSignalsDe, int8_t ); // ! Number of ITS signas
85+ DECLARE_SOA_COLUMN (CandidateSelFlag, candidateSelFlag, int8_t ); // ! Candidates falg
86+ DECLARE_SOA_COLUMN (Cent, cent, float ); // ! Centrality
87+ DECLARE_SOA_COLUMN (GIndexCol, gIndexCol , int ); // ! Global index for the collisionAdd commentMore actions
88+ DECLARE_SOA_COLUMN (TimeStamp, timeStamp, int64_t ); // ! Timestamp for the collision
89+ } // namespace full
90+
91+ // Full table: include ALL columns declared above
92+ DECLARE_SOA_TABLE (HfCandCd, " AOD" , " HFCANDCD" ,
93+ full::M,
94+ full::Pt,
95+ full::PtProng0,
96+ full::PtProng1,
97+ full::PtProng2,
98+ full::ImpactParameter0,
99+ full::ImpactParameter1,
100+ full::ImpactParameter2,
101+ full::DecayLength,
102+ full::Cpa,
103+ full::NSigmaTpcDe,
104+ full::NSigmaItsDe,
105+ full::NSigmaTofDe,
106+ full::NItsClusters,
107+ full::NItsNClusterSize,
108+ full::NTpcClusters,
109+ full::NTpcSignalsDe,
110+ full::NItsSignalsDe,
111+ full::CandidateSelFlag,
112+ full::Cent,
113+ full::GIndexCol,
114+ full::TimeStamp);
115+ } // namespace o2::aod
116+
55117struct HfTaskCd {
118+
119+ Produces<o2::aod::HfCandCd> rowCandCd;
56120 Configurable<int > selectionFlagCd{" selectionFlagCd" , 1 , " Selection Flag for Cd" };
57121 Configurable<std::vector<double >> binsPt{" binsPt" , std::vector<double >{hf_cuts_cd_to_de_k_pi::vecBinsPt}, " pT bin limits" };
58122 Configurable<bool > fillTHn{" fillTHn" , false , " fill THn" };
123+ Configurable<bool > fillTree{" fillTree" , false , " Flag to fill candiates tree" };
59124
60125 SliceCache cache;
61126
62127 using CollisionsWEvSel = soa::Join<aod::Collisions, aod::EvSels>;
63128 using CollisionsWithEvSelFT0C = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>;
64129 using CollisionsWithEvSelFT0M = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms>;
65130
66- using CdCandidates = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelCd>>;
131+ using CdCandidates = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelCd, aod::HfCand3ProngWPidPiKaDe>>;
132+ using HFTracks = soa::Join<aod::FullTracks, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullDe, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullDe>;
67133
68134 Filter filterSelectCandidates = aod::hf_sel_candidate_cd::isSelCdToDeKPi >= selectionFlagCd;
69135 Preslice<aod::HfCand3Prong> candCdPerCollision = aod::hf_cand::collisionId;
@@ -139,7 +205,15 @@ struct HfTaskCd {
139205 registry.add (" Data/hImpParErrProng0" , " 3-prong candidates;prong 0 impact parameter error (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
140206 registry.add (" Data/hImpParErrProng1" , " 3-prong candidates;prong 1 impact parameter error (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
141207 registry.add (" Data/hImpParErrProng2" , " 3-prong candidates;prong 2 impact parameter error (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
142-
208+ registry.add (" Data/hNsigmaTPCDeVsP" , " deuteron;#it{p} (GeV/#it{c}); n#sigma^{TPC}_{d}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
209+ registry.add (" Data/hNsigmaTOFDeVsP" , " deuteron;#it{p} (GeV/#it{c}); n#sigma^{TOF}_{d}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
210+ registry.add (" Data/hNsigmaITSDeVsP" , " deuteron;#it{p} (GeV/#it{c}); n#sigma^{ITS}_{d}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
211+ registry.add (" Data/hTPCSignalDeVsP" , " deuteron;#it{p} (GeV/#it{c}); n#sigma^{ITS}_{d}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {2000 , 0 , 2000 }}});
212+ registry.add (" Data/hITSSignalDeVsP" , " deuteron;#it{p} (GeV/#it{c}); n#sigma^{ITS}_{d}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {20 , 0 , 20 }}});
213+ registry.add (" Data/hNsigmaTPCPiVsP" , " Pion;#it{p} (GeV/#it{c});n#sigma^{TPC}_{pi};" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
214+ registry.add (" Data/hNsigmaTOFPiVsP" , " Pion;#it{p} (GeV/#it{c});n#sigma^{TOF}_{pi};" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
215+ registry.add (" Data/hNsigmaTPCKaVsP" , " Kaon;#it{p} (GeV/#it{c}); n#sigma^{TPC}_{Kaon}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
216+ registry.add (" Data/hNsigmaTOFKaVsP" , " Kaon;#it{p} (GeV/#it{c}); n#sigma^{TOF}_{Kaon}" , {HistType::kTH2F , {{200 , -10 .f , 10 .f }, {200 , -6 .f , 6 .f }}});
143217 if (fillTHn) {
144218 const AxisSpec thnAxisMass{thnConfigAxisMass, " inv. mass (de K #pi) (GeV/#it{c}^{2})" };
145219 const AxisSpec thnAxisPt{thnConfigAxisPt, " #it{p}_{T}(C_{d}^{+}) (GeV/#it{c})" };
@@ -156,13 +230,33 @@ struct HfTaskCd {
156230 }
157231 }
158232
233+ // taken from: https://github.com/AliceO2Group/O2Physics/blob/master/EventFiltering/PWGCF/CFFilterAll.cxx
234+ template <typename T>
235+ float itsSignal (T const & track)
236+ {
237+ uint32_t clsizeflag = track.itsClusterSizes ();
238+ auto clSizeLayer0 = (clsizeflag >> (0 * 4 )) & 0xf ;
239+ auto clSizeLayer1 = (clsizeflag >> (1 * 4 )) & 0xf ;
240+ auto clSizeLayer2 = (clsizeflag >> (2 * 4 )) & 0xf ;
241+ auto clSizeLayer3 = (clsizeflag >> (3 * 4 )) & 0xf ;
242+ auto clSizeLayer4 = (clsizeflag >> (4 * 4 )) & 0xf ;
243+ auto clSizeLayer5 = (clsizeflag >> (5 * 4 )) & 0xf ;
244+ auto clSizeLayer6 = (clsizeflag >> (6 * 4 )) & 0xf ;
245+ int numLayers = 7 ;
246+ int sumClusterSizes = clSizeLayer1 + clSizeLayer2 + clSizeLayer3 + clSizeLayer4 + clSizeLayer5 + clSizeLayer6 + clSizeLayer0;
247+ float cosLamnda = 1 . / std::cosh (track.eta ());
248+ return (static_cast <float >(sumClusterSizes) / numLayers) * cosLamnda;
249+ };
250+
159251 // / Fill histograms for real data
160- template <typename CollType, typename CandType>
161- void fillHistosData (CollType const & collision, CandType const & candidates)
252+ template <typename CollType, typename CandType, typename TrackType >
253+ void fillHistosData (CollType const & collision, CandType const & candidates, TrackType const & )
162254 {
163255 auto thisCollId = collision.globalIndex ();
164256 auto groupedCdCandidates = candidates.sliceBy (candCdPerCollision, thisCollId);
165257 auto numPvContributors = collision.numContrib ();
258+ auto bc = collision.template bc_as <aod::BCsWithTimestamps>();
259+ int64_t timeStamp = bc.timestamp ();
166260
167261 for (const auto & candidate : groupedCdCandidates) {
168262 if (!TESTBIT (candidate.hfflag (), aod::hf_cand_3prong::DecayType::CdToDeKPi)) {
@@ -178,6 +272,13 @@ struct HfTaskCd {
178272 const auto chi2PCA = candidate.chi2PCA ();
179273 const auto cpa = candidate.cpa ();
180274 const auto cpaXY = candidate.cpaXY ();
275+ float invMassCd = 0 .f ;
276+ if (candidate.isSelCdToDeKPi () >= selectionFlagCd) {
277+ invMassCd = HfHelper::invMassCdToDeKPi (candidate);
278+ }
279+ if (candidate.isSelCdToPiKDe () >= selectionFlagCd) {
280+ invMassCd = HfHelper::invMassCdToPiKDe (candidate);
281+ }
181282
182283 if (candidate.isSelCdToDeKPi () >= selectionFlagCd) {
183284 registry.fill (HIST (" Data/hMass" ), HfHelper::invMassCdToDeKPi (candidate));
@@ -219,8 +320,9 @@ struct HfTaskCd {
219320 registry.fill (HIST (" Data/hImpParErrProng1" ), candidate.errorImpactParameter1 (), pt);
220321 registry.fill (HIST (" Data/hImpParErrProng2" ), candidate.errorImpactParameter2 (), pt);
221322
323+ float const cent = o2::hf_centrality::getCentralityColl (collision);
324+
222325 if (fillTHn) {
223- float const cent = o2::hf_centrality::getCentralityColl (collision);
224326 double massCd (-1 );
225327 if (candidate.isSelCdToDeKPi () >= selectionFlagCd) {
226328 massCd = HfHelper::invMassCdToDeKPi (candidate);
@@ -233,40 +335,140 @@ struct HfTaskCd {
233335 registry.get <THnSparse>(HIST (" hnCdVars" ))->Fill (valuesToFill.data ());
234336 }
235337 }
338+
339+ if (fillTree) {
340+ int candFlag = -999 ;
341+
342+ float nSigmaTpcDe = 0 .f , nSigmaTpcKa = 0 .f , nSigmaTpcPi = 0 .f ;
343+ float nSigmaItsDe = 0 .f ;
344+ float nSigmaTofDe = 0 .f , nSigmaTofKa = 0 .f , nSigmaTofPi = 0 .f ;
345+
346+ int itsNClusterDe = 0 ;
347+ int itsNClusterSizeDe = 0 ;
348+ int tpcNClusterDe = 0 ;
349+
350+ float tpcSignalsDe = 0 .f ;
351+ float itsSignalsDe = 0 .f ;
352+
353+ float pSignedDe = -999 .f ;
354+ float pSignedPi = -999 .f ;
355+
356+ nSigmaTpcKa = candidate.nSigTpcKa1 ();
357+ nSigmaTofKa = candidate.nSigTofKa1 ();
358+
359+ const bool selDeKPi = (candidate.isSelCdToDeKPi () >= 1 );
360+ const bool selPiKDe = (candidate.isSelCdToPiKDe () >= 1 );
361+
362+ auto prong0 = candidate.template prong0_as <TrackType>();
363+ auto prong1 = candidate.template prong1_as <TrackType>();
364+ auto prong2 = candidate.template prong2_as <TrackType>();
365+
366+ if (selDeKPi) {
367+ candFlag = 1 ;
368+ pSignedDe = prong0.p () * prong0.sign ();
369+ pSignedPi = prong2.p () * prong2.sign ();
370+ nSigmaTpcDe = candidate.nSigTpcDe0 ();
371+ nSigmaTofDe = candidate.nSigTofDe0 ();
372+ nSigmaTpcPi = candidate.nSigTpcPi2 ();
373+ nSigmaTofPi = candidate.nSigTofPi2 ();
374+ nSigmaItsDe = prong0.itsNSigmaDe ();
375+ itsNClusterDe = prong0.itsNCls ();
376+ itsNClusterSizeDe = prong0.itsClusterSizes ();
377+ tpcNClusterDe = prong0.tpcNClsCrossedRows ();
378+ tpcSignalsDe = prong0.tpcSignal ();
379+ itsSignalsDe = itsSignal (prong0);
380+ } else if (selPiKDe) {
381+ candFlag = -1 ;
382+ pSignedDe = prong2.p () * prong2.sign ();
383+ pSignedPi = prong0.p () * prong0.sign ();
384+ nSigmaTpcDe = candidate.nSigTpcDe2 ();
385+ nSigmaTofDe = candidate.nSigTofDe2 ();
386+ nSigmaTpcPi = candidate.nSigTpcPi0 ();
387+ nSigmaTofPi = candidate.nSigTofPi0 ();
388+ nSigmaItsDe = prong2.itsNSigmaDe ();
389+ itsNClusterDe = prong2.itsNCls ();
390+ itsNClusterSizeDe = prong2.itsClusterSizes ();
391+ tpcNClusterDe = prong2.tpcNClsCrossedRows ();
392+ tpcSignalsDe = prong2.tpcSignal ();
393+ itsSignalsDe = itsSignal (prong2);
394+ }
395+
396+ // PID QA
397+ registry.fill (HIST (" Data/hNsigmaTPCDeVsP" ), pSignedDe, nSigmaTpcDe);
398+ registry.fill (HIST (" Data/hNsigmaTOFDeVsP" ), pSignedDe, nSigmaTofDe);
399+ registry.fill (HIST (" Data/hNsigmaITSDeVsP" ), pSignedDe, nSigmaItsDe);
400+ registry.fill (HIST (" Data/hTPCSignalDeVsP" ), pSignedDe, tpcSignalsDe);
401+ registry.fill (HIST (" Data/hITSSignalDeVsP" ), pSignedDe, itsSignalsDe);
402+ registry.fill (HIST (" Data/hNsigmaTPCPiVsP" ), pSignedPi, nSigmaTpcPi);
403+ registry.fill (HIST (" Data/hNsigmaTOFPiVsP" ), pSignedPi, nSigmaTofPi);
404+ registry.fill (HIST (" Data/hNsigmaTPCKaVsP" ), prong1.p () * prong1.sign (), nSigmaTpcKa);
405+ registry.fill (HIST (" Data/hNsigmaTOFKaVsP" ), prong1.p () * prong1.sign (), nSigmaTofKa);
406+
407+ rowCandCd (
408+ invMassCd,
409+ pt,
410+ ptProng0,
411+ ptProng1,
412+ ptProng2,
413+ candidate.impactParameter0 (),
414+ candidate.impactParameter1 (),
415+ candidate.impactParameter2 (),
416+ decayLength,
417+ cpa,
418+ nSigmaTpcDe,
419+ nSigmaItsDe,
420+ nSigmaTofDe,
421+ itsNClusterDe,
422+ itsNClusterSizeDe,
423+ tpcNClusterDe,
424+ tpcSignalsDe,
425+ itsSignalsDe,
426+ candFlag,
427+ cent,
428+ collision.globalIndex (),
429+ timeStamp);
430+ }
236431 }
237432 }
238433 // / Run the analysis on real data
239- template <typename CollType, typename CandType>
434+ template <typename CollType, typename CandType, typename TrackType >
240435 void runAnalysisPerCollisionData (CollType const & collisions,
241- CandType const & candidates)
436+ CandType const & candidates,
437+ TrackType const & tracks)
242438 {
243439
244440 for (const auto & collision : collisions) {
245- fillHistosData (collision, candidates);
441+ fillHistosData (collision, candidates, tracks );
246442 }
247443 }
248444
249445 void processDataStd (CollisionsWEvSel const & collisions,
250446 CdCandidates const & selectedCdCandidates,
251- aod::Tracks const &)
447+ HFTracks const & tracks )
252448 {
253- runAnalysisPerCollisionData (collisions, selectedCdCandidates);
449+ // inlcude ITS PID information
450+ auto tracksWithItsPid = soa::Attach<HFTracks, aod::pidits::ITSNSigmaPi, aod::pidits::ITSNSigmaPr, aod::pidits::ITSNSigmaDe>(tracks);
451+ runAnalysisPerCollisionData (collisions, selectedCdCandidates, tracksWithItsPid);
254452 }
255453 PROCESS_SWITCH (HfTaskCd, processDataStd, " Process Data with the standard method" , true );
256454
257455 void processDataStdWithFT0C (CollisionsWithEvSelFT0C const & collisions,
258456 CdCandidates const & selectedCdCandidates,
259- aod::Tracks const &)
457+ HFTracks const & tracks )
260458 {
261- runAnalysisPerCollisionData (collisions, selectedCdCandidates);
459+ // inlcude ITS PID information
460+ auto tracksWithItsPid = soa::Attach<HFTracks, aod::pidits::ITSNSigmaPi, aod::pidits::ITSNSigmaPr, aod::pidits::ITSNSigmaDe>(tracks);
461+ runAnalysisPerCollisionData (collisions, selectedCdCandidates, tracksWithItsPid);
262462 }
263463 PROCESS_SWITCH (HfTaskCd, processDataStdWithFT0C, " Process real data with the standard method and with FT0C centrality" , false );
264464
265465 void processDataStdWithFT0M (CollisionsWithEvSelFT0M const & collisions,
266466 CdCandidates const & selectedCdCandidates,
267- aod::Tracks const &)
467+ HFTracks const & tracks )
268468 {
269- runAnalysisPerCollisionData (collisions, selectedCdCandidates);
469+ // inlcude ITS PID information
470+ auto tracksWithItsPid = soa::Attach<HFTracks, aod::pidits::ITSNSigmaPi, aod::pidits::ITSNSigmaPr, aod::pidits::ITSNSigmaDe>(tracks);
471+ runAnalysisPerCollisionData (collisions, selectedCdCandidates, tracksWithItsPid);
270472 }
271473 PROCESS_SWITCH (HfTaskCd, processDataStdWithFT0M, " Process real data with the standard method and with FT0M centrality" , false );
272474};
0 commit comments