3535#include " Framework/runDataProcessing.h"
3636// / O2Physics
3737#include " PWGDQ/DataModel/ReducedInfoTables.h"
38+ #include " PWGLF/DataModel/LFStrangenessPIDTables.h"
3839#include " PWGLF/DataModel/LFStrangenessTables.h"
3940
4041#include " Common/CCDB/ctpRateFetcher.h"
@@ -62,8 +63,8 @@ struct TreeWriterTpcV0 {
6263 using TrksWithDEdxCorrection = soa::Join<aod::Tracks, aod::V0Bits, aod::TracksExtra, aod::pidTPCFullEl, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFFullEl, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::TrackSelection, aod::DEdxsCorrected>;
6364 using Colls = soa::Join<aod::Collisions, aod::Mults, aod::EvSels>;
6465 using MyBCTable = soa::Join<aod::BCsWithTimestamps, aod::BCTFinfoTable>;
65- using V0sWithID = soa::Join<aod::V0Datas, aod::V0MapID>;
66- using CascsWithID = soa::Join<aod::CascDatas, aod::CascMapID>;
66+ using V0sWithID = soa::Join<aod::V0Datas, aod::V0MapID, aod::V0TOFNSigmas >;
67+ using CascsWithID = soa::Join<aod::CascDatas, aod::CascMapID, aod::CascTOFNSigmas >;
6768
6869 // / Tables to be produced
6970 Produces<o2::aod::SkimmedTPCV0Tree> rowTPCTree;
@@ -162,18 +163,18 @@ struct TreeWriterTpcV0 {
162163 bool rejectNoTofDauTrack{false };
163164 };
164165
165- template <bool IsCorrectedDeDx, typename T>
166- V0Daughter createV0Daughter (const T& track, const int daughterId)
166+ template <bool IsCorrectedDeDx, typename V0Casc, typename T>
167+ V0Daughter createV0Daughter (const V0Casc& v0Casc, const T& track, const int motherId, const int daughterId, const bool isPositive = true )
167168 {
168169 switch (daughterId) {
169170 case DaughterElectron:
170- return V0Daughter{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, track.tpcNSigmaEl (), track. tofNSigmaEl ( ), track.tpcExpSignalEl (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidElectron, dwnSmplFactorEl, nSigmaTofDauTrackEl, rejectNoTofDauTrackEl};
171+ return V0Daughter{downsamplingTsalisElectrons, MassElectron, maxPt4dwnsmplTsalisElectrons, track.tpcNSigmaEl (), getStrangenessTofNSigma (v0Casc, motherId, daughterId, isPositive ), track.tpcExpSignalEl (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidElectron, dwnSmplFactorEl, nSigmaTofDauTrackEl, rejectNoTofDauTrackEl};
171172 case DaughterPion:
172- return V0Daughter{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, track.tpcNSigmaPi (), track. tofNSigmaPi ( ), track.tpcExpSignalPi (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidPion, dwnSmplFactorPi, nSigmaTofDauTrackPi, rejectNoTofDauTrackPi};
173+ return V0Daughter{downsamplingTsalisPions, MassPiPlus, maxPt4dwnsmplTsalisPions, track.tpcNSigmaPi (), getStrangenessTofNSigma (v0Casc, motherId, daughterId, isPositive ), track.tpcExpSignalPi (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidPion, dwnSmplFactorPi, nSigmaTofDauTrackPi, rejectNoTofDauTrackPi};
173174 case DaughterProton:
174- return V0Daughter{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, track.tpcNSigmaPr (), track. tofNSigmaPr ( ), track.tpcExpSignalPr (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidProton, dwnSmplFactorPr, nSigmaTofDauTrackPr, rejectNoTofDauTrackPr};
175+ return V0Daughter{downsamplingTsalisProtons, MassProton, maxPt4dwnsmplTsalisProtons, track.tpcNSigmaPr (), getStrangenessTofNSigma (v0Casc, motherId, daughterId, isPositive ), track.tpcExpSignalPr (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidProton, dwnSmplFactorPr, nSigmaTofDauTrackPr, rejectNoTofDauTrackPr};
175176 case DaughterKaon:
176- return V0Daughter{downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons, track.tpcNSigmaKa (), track. tofNSigmaKa ( ), track.tpcExpSignalKa (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidKaon, dwnSmplFactorKa, nSigmaTofDauTrackKa, rejectNoTofDauTrackKa};
177+ return V0Daughter{downsamplingTsalisKaons, MassKPlus, maxPt4dwnsmplTsalisKaons, track.tpcNSigmaKa (), getStrangenessTofNSigma (v0Casc, motherId, daughterId, isPositive ), track.tpcExpSignalKa (tpcSignalGeneric<IsCorrectedDeDx>(track)), PidKaon, dwnSmplFactorKa, nSigmaTofDauTrackKa, rejectNoTofDauTrackKa};
177178 default : {
178179 LOGP (fatal, " createV0Daughter: unknown daughterId" );
179180 return V0Daughter ();
@@ -204,7 +205,41 @@ struct TreeWriterTpcV0 {
204205 }
205206 }
206207
207- // / Funktion to fill skimmed tables
208+ float getStrangenessTofNSigma (V0sWithID::iterator const & v0, const int motherId, const int daughterId, const bool isPositive)
209+ {
210+ if (motherId == MotherGamma && daughterId == DaughterElectron) {
211+ return -999 .f ;
212+ } else if (motherId == MotherK0S && daughterId == DaughterPion) {
213+ if (isPositive)
214+ return v0.tofNSigmaK0PiPlus ();
215+ else
216+ return v0.tofNSigmaK0PiMinus ();
217+ } else if (motherId == MotherLambda) {
218+ if (daughterId == DaughterProton && isPositive)
219+ return v0.tofNSigmaLaPr ();
220+ else if (daughterId == DaughterPion && !isPositive)
221+ return v0.tofNSigmaLaPi ();
222+ } else if (motherId == MotherAntiLambda) {
223+ if (daughterId == DaughterProton && !isPositive)
224+ return v0.tofNSigmaALaPr ();
225+ else if (daughterId == DaughterPion && isPositive)
226+ return v0.tofNSigmaALaPi ();
227+ }
228+
229+ LOGP (fatal, " getStrangenessTofNSigma for V0: wrong combination of motherId, daughterId and sign" );
230+ return -999 .f ;
231+ }
232+
233+ float getStrangenessTofNSigma (CascsWithID::iterator const & casc, const int motherId, const int daughterId, bool )
234+ {
235+ if ((motherId == MotherOmega || motherId == MotherAntiOmega) && daughterId == DaughterKaon)
236+ return casc.tofNSigmaOmKa ();
237+
238+ LOGP (fatal, " getStrangenessTofNSigma for cascade: wrong combination of motherId and daughterId" );
239+ return -999 .f ;
240+ }
241+
242+ // / Function to fill skimmed tables
208243 template <bool DoUseCorrectedDeDx = false , typename T, typename C, typename V0Casc>
209244 void fillSkimmedV0Table (V0Casc const & v0casc, T const & track, C const & collision, const float nSigmaTPC, const float nSigmaTOF, const float dEdxExp, const o2::track::PID::ID id, const int runnumber, const double dwnSmplFactor, const float hadronicRate)
210245 {
@@ -477,27 +512,29 @@ struct TreeWriterTpcV0 {
477512
478513 // / Loop over v0 candidates
479514 for (const auto & v0 : v0s) {
480- if (v0.v0addid () == MotherUndef) {
515+ const auto v0Id = v0.v0addid ();
516+ if (v0Id == MotherUndef) {
481517 continue ;
482518 }
483519 const auto & posTrack = v0.posTrack_as <soa::Filtered<TrksType>>();
484520 const auto & negTrack = v0.negTrack_as <soa::Filtered<TrksType>>();
485521
486- const V0Mother v0Mother = createV0Mother (v0. v0addid () );
487- const V0Daughter posDaughter = createV0Daughter<IsCorrectedDeDx>(posTrack, v0Mother.posDaughterId );
488- const V0Daughter negDaughter = createV0Daughter<IsCorrectedDeDx>(negTrack, v0Mother.negDaughterId );
522+ const V0Mother v0Mother = createV0Mother (v0Id );
523+ const V0Daughter posDaughter = createV0Daughter<IsCorrectedDeDx>(v0, posTrack, v0Id, v0Mother.posDaughterId , true );
524+ const V0Daughter negDaughter = createV0Daughter<IsCorrectedDeDx>(v0, negTrack, v0Id, v0Mother.negDaughterId , false );
489525
490526 fillDaughterTrack (v0, posTrack, posDaughter);
491527 fillDaughterTrack (v0, negTrack, negDaughter);
492528 }
493529
494530 // / Loop over cascade candidates
495531 for (const auto & casc : cascs) {
496- if (casc.cascaddid () == MotherUndef) {
532+ const auto cascId = casc.cascaddid ();
533+ if (cascId == MotherUndef) {
497534 continue ;
498535 }
499536 const auto & bachTrack = casc.bachelor_as <soa::Filtered<TrksType>>();
500- const V0Daughter bachDaughter = createV0Daughter<IsCorrectedDeDx>(bachTrack, DaughterKaon);
537+ const V0Daughter bachDaughter = createV0Daughter<IsCorrectedDeDx>(casc, bachTrack, cascId , DaughterKaon);
501538 // Omega and antiomega
502539 fillDaughterTrack (casc, bachTrack, bachDaughter);
503540 }
@@ -576,7 +613,8 @@ struct TreeWriterTpcV0 {
576613
577614 // / Loop over v0 candidates
578615 for (const auto & v0 : v0s) {
579- if (v0.v0addid () == MotherUndef) {
616+ const auto v0Id = v0.v0addid ();
617+ if (v0Id == MotherUndef) {
580618 continue ;
581619 }
582620 const auto & posTrack = v0.posTrack_as <TrksType>();
@@ -585,21 +623,22 @@ struct TreeWriterTpcV0 {
585623 const auto & [posTrackQA, existPosTrkQA] = getTrackQA (posTrack);
586624 const auto & [negTrackQA, existNegTrkQA] = getTrackQA (negTrack);
587625
588- const V0Mother v0Mother = createV0Mother (v0. v0addid () );
589- const V0Daughter posDaughter = createV0Daughter<IsCorrectedDeDx>(posTrack, v0Mother.posDaughterId );
590- const V0Daughter negDaughter = createV0Daughter<IsCorrectedDeDx>(negTrack, v0Mother.negDaughterId );
626+ const V0Mother v0Mother = createV0Mother (v0Id );
627+ const V0Daughter posDaughter = createV0Daughter<IsCorrectedDeDx>(v0, posTrack, v0Id, v0Mother.posDaughterId , true );
628+ const V0Daughter negDaughter = createV0Daughter<IsCorrectedDeDx>(v0, negTrack, v0Id, v0Mother.negDaughterId , false );
591629
592630 fillDaughterTrack (v0, posTrack, posDaughter, posTrackQA, existPosTrkQA);
593631 fillDaughterTrack (v0, negTrack, negDaughter, negTrackQA, existNegTrkQA);
594632 }
595633
596634 // / Loop over cascade candidates
597635 for (const auto & casc : cascs) {
598- if (casc.cascaddid () == MotherUndef) {
636+ const auto cascId = casc.cascaddid ();
637+ if (cascId == MotherUndef) {
599638 continue ;
600639 }
601640 const auto & bachTrack = casc.bachelor_as <TrksType>();
602- const V0Daughter bachDaughter = createV0Daughter<IsCorrectedDeDx>(bachTrack, DaughterKaon);
641+ const V0Daughter bachDaughter = createV0Daughter<IsCorrectedDeDx>(casc, bachTrack, cascId , DaughterKaon);
603642 const auto & [bachTrackQA, existBachTrkQA] = getTrackQA (bachTrack);
604643 // Omega and antiomega
605644 fillDaughterTrack (casc, bachTrack, bachDaughter, bachTrackQA, existBachTrkQA);
0 commit comments