2323
2424#include " Common/Core/TrackSelection.h"
2525#include " Common/Core/TrackSelectionDefaults.h"
26+ #include " Common/DataModel/PIDResponseITS.h"
2627#include " Common/DataModel/PIDResponseTOF.h"
2728#include " Common/DataModel/PIDResponseTPC.h"
2829#include " Common/DataModel/TrackSelectionTables.h"
@@ -135,6 +136,14 @@ class FemtoUniverseTrackSelection : public FemtoUniverseObjectSelection<float, f
135136 template <typename T>
136137 auto getNsigmaTOF (T const & track, o2::track::PID pid);
137138
139+ // / Computes the n_sigma for a track and a particle-type hypothesis in the TOF
140+ // / \tparam T Data type of the track
141+ // / \param track Track for which PID is evaluated
142+ // / \param pid Particle species for which PID is evaluated
143+ // / \return Value of n_{sigma, TOF}
144+ template <typename T>
145+ auto getNsigmaITS (T const & track, o2::track::PID pid);
146+
138147 // / Checks whether the most open combination of all selection criteria is fulfilled
139148 // / \tparam T Data type of the track
140149 // / \param track Track
@@ -151,6 +160,18 @@ class FemtoUniverseTrackSelection : public FemtoUniverseObjectSelection<float, f
151160 template <typename CutContainerType, typename T>
152161 std::array<CutContainerType, 2 > getCutContainer (T const & track);
153162
163+ // / Obtain the bit-wise container for the selections
164+ // / \todo For the moment, PID is separated from the other selections, hence
165+ // / instead of a single value an std::array of size two is returned
166+ // / \tparam CutContainerType Data type of the bit-wise container for the
167+ // / selections
168+ // / \tparam T Data type of the track
169+ // / \param track Track
170+ // / \return The bit-wise container for the selections, separately with all
171+ // / selection criteria, and the PID
172+ template <typename CutContainerType, typename T>
173+ std::array<CutContainerType, 2 > getCutContainerWithITS (T const & track);
174+
154175 // / Some basic QA histograms
155176 // / \tparam part Type of the particle for proper naming of the folders for QA
156177 // / \tparam tracktype Type of track (track, positive child, negative child) for proper naming of the folders for QA
@@ -329,6 +350,11 @@ void FemtoUniverseTrackSelection::init(HistogramRegistry* registry)
329350 mHistogramRegistry ->add ((folderName + " /hDCAz" ).c_str (), " ; #it{p}_{T} (GeV/#it{c}); DCA_{z} (cm)" , kTH2F , {{100 , 0 , 10 }, {500 , -5 , 5 }});
330351 mHistogramRegistry ->add ((folderName + " /hDCA" ).c_str (), " ; #it{p}_{T} (GeV/#it{c}); DCA (cm)" , kTH2F , {{100 , 0 , 10 }, {301 , 0 ., 1.5 }});
331352 mHistogramRegistry ->add ((folderName + " /hTPCdEdX" ).c_str (), " ; #it{p} (GeV/#it{c}); TPC Signal" , kTH2F , {{100 , 0 , 10 }, {1000 , 0 , 1000 }});
353+ mHistogramRegistry ->add ((folderName + " /nSigmaITS_el" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{ITS}^{e}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
354+ mHistogramRegistry ->add ((folderName + " /nSigmaITS_pi" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{ITS}^{#pi}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
355+ mHistogramRegistry ->add ((folderName + " /nSigmaITS_K" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{ITS}^{K}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
356+ mHistogramRegistry ->add ((folderName + " /nSigmaITS_p" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{ITS}^{p}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
357+ mHistogramRegistry ->add ((folderName + " /nSigmaITS_d" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{ITS}^{d}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
332358 mHistogramRegistry ->add ((folderName + " /nSigmaTPC_el" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{e}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
333359 mHistogramRegistry ->add ((folderName + " /nSigmaTPC_pi" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{#pi}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
334360 mHistogramRegistry ->add ((folderName + " /nSigmaTPC_K" ).c_str (), " ; #it{p} (GeV/#it{c}); n#sigma_{TPC}^{K}" , kTH2F , {{100 , 0 , 10 }, {200 , -4.975 , 5.025 }});
@@ -394,6 +420,24 @@ auto FemtoUniverseTrackSelection::getNsigmaTOF(T const& track, o2::track::PID pi
394420 return o2::aod::pidutils::tofNSigma (pid, track);
395421}
396422
423+ template <typename T>
424+ auto FemtoUniverseTrackSelection::getNsigmaITS (T const & track, o2::track::PID pid)
425+ {
426+ if (pid == o2::track::PID::Electron) {
427+ return track.itsNSigmaEl ();
428+ } else if (pid == o2::track::PID::Pion) {
429+ return track.itsNSigmaPi ();
430+ } else if (pid == o2::track::PID::Kaon) {
431+ return track.itsNSigmaKa ();
432+ } else if (pid == o2::track::PID::Proton) {
433+ return track.itsNSigmaPr ();
434+ } else if (pid == o2::track::PID::Deuteron) {
435+ return track.itsNSigmaDe ();
436+ }
437+ // if nothing matched, return default value
438+ return -999 .f ;
439+ }
440+
397441template <typename T>
398442bool FemtoUniverseTrackSelection::isSelectedMinimal (T const & track)
399443{
@@ -565,6 +609,101 @@ std::array<CutContainerType, 2> FemtoUniverseTrackSelection::getCutContainer(T c
565609 return {output, outputPID};
566610}
567611
612+ template <typename CutContainerType, typename T>
613+ std::array<CutContainerType, 2 >
614+ FemtoUniverseTrackSelection::getCutContainerWithITS (T const & track)
615+ {
616+ CutContainerType output = 0 ;
617+ size_t counter = 0 ;
618+ CutContainerType outputPID = 0 ;
619+ const auto sign = track.sign ();
620+ const auto pT = track.pt ();
621+ const auto eta = track.eta ();
622+ const auto tpcNClsF = track.tpcNClsFound ();
623+ const auto tpcRClsC = track.tpcCrossedRowsOverFindableCls ();
624+ const auto tpcNClsC = track.tpcNClsCrossedRows ();
625+ const auto tpcNClsS = track.tpcNClsShared ();
626+ const auto tpcNClsFracS = track.tpcFractionSharedCls ();
627+ const auto itsNCls = track.itsNCls ();
628+ const auto itsNClsIB = track.itsNClsInnerBarrel ();
629+ const auto dcaXY = track.dcaXY ();
630+ const auto dcaZ = track.dcaZ ();
631+ const auto dca = std::sqrt (std::pow (dcaXY, 2 .) + std::pow (dcaZ, 2 .));
632+
633+ std::vector<float > pidTPC, pidTOF, pidITS;
634+ for (auto it : kPIDspecies ) {
635+ pidTPC.push_back (getNsigmaTPC (track, it));
636+ pidTOF.push_back (getNsigmaTOF (track, it));
637+ pidITS.push_back (getNsigmaITS (track, it));
638+ }
639+
640+ float observable = 0 .;
641+ for (auto & sel : mSelections ) {
642+ const auto selVariable = sel.getSelectionVariable ();
643+ if (selVariable == femto_universe_track_selection::kPIDnSigmaMax ) {
644+ // / PID needs to be handled a bit differently since we may need more than
645+ // / one species
646+ for (size_t i = 0 ; i < kPIDspecies .size (); ++i) {
647+ auto pidITSVal = pidITS.at (i);
648+ auto pidTPCVal = pidTPC.at (i) - nSigmaPIDOffsetTPC;
649+ auto pidTOFVal = pidTOF.at (i) - nSigmaPIDOffsetTOF;
650+ auto pidComb = std::sqrt (pidTPCVal * pidTPCVal + pidTOFVal * pidTOFVal);
651+ sel.checkSelectionSetBitPID (pidTPCVal, outputPID);
652+ sel.checkSelectionSetBitPID (pidComb, outputPID);
653+ sel.checkSelectionSetBitPID (pidITSVal, outputPID);
654+ }
655+ } else {
656+ // / for the rest it's all the same
657+ switch (selVariable) {
658+ case (femto_universe_track_selection::kSign ):
659+ observable = sign;
660+ break ;
661+ case (femto_universe_track_selection::kpTMin):
662+ case (femto_universe_track_selection::kpTMax):
663+ observable = pT;
664+ break ;
665+ case (femto_universe_track_selection::kEtaMax ):
666+ observable = eta;
667+ break ;
668+ case (femto_universe_track_selection::kTPCnClsMin ):
669+ observable = tpcNClsF;
670+ break ;
671+ case (femto_universe_track_selection::kTPCfClsMin ):
672+ observable = tpcRClsC;
673+ break ;
674+ case (femto_universe_track_selection::kTPCcRowsMin ):
675+ observable = tpcNClsC;
676+ break ;
677+ case (femto_universe_track_selection::kTPCsClsMax ):
678+ observable = tpcNClsS;
679+ break ;
680+ case (femto_universe_track_selection::kTPCfracsClsMax ):
681+ observable = tpcNClsFracS;
682+ break ;
683+ case (femto_universe_track_selection::kITSnClsMin ):
684+ observable = itsNCls;
685+ break ;
686+ case (femto_universe_track_selection::kITSnClsIbMin ):
687+ observable = itsNClsIB;
688+ break ;
689+ case (femto_universe_track_selection::kDCAxyMax ):
690+ observable = dcaXY;
691+ break ;
692+ case (femto_universe_track_selection::kDCAzMax ):
693+ observable = dcaZ;
694+ break ;
695+ case (femto_universe_track_selection::kDCAMin ):
696+ observable = dca;
697+ break ;
698+ case (femto_universe_track_selection::kPIDnSigmaMax ):
699+ break ;
700+ }
701+ sel.checkSelectionSetBit (observable, output, counter);
702+ }
703+ }
704+ return {output, outputPID};
705+ }
706+
568707template <o2::aod::femtouniverseparticle::ParticleType part, o2::aod::femtouniverseparticle::TrackType tracktype, typename T>
569708void FemtoUniverseTrackSelection::fillQA (T const & track)
570709{
0 commit comments