4040#include " Common/Core/ZorroSummary.h"
4141#include " Common/Core/trackUtilities.h"
4242#include " Common/DataModel/EventSelection.h"
43+ #include " Common/DataModel/PIDResponseITS.h"
4344#include " Common/DataModel/PIDResponseTOF.h"
45+ #include " Common/DataModel/PIDResponseTPC.h"
4446#include " Common/DataModel/TrackSelectionTables.h"
4547
4648#include < CCDB/BasicCCDBManager.h>
@@ -272,6 +274,9 @@ struct DeuteronInTriggeredEvents {
272274 Zorro zorro; // Definition of Zorro: helpful for skimmed data
273275 OutputObj<ZorroSummary> zorroSummary{" zorroSummary" };
274276
277+ // Initialize ITS PID Response object
278+ o2::aod::ITSResponse itsResponse;
279+
275280 Configurable<bool > cfgCompensatePIDinTracking{" cfgCompensatePIDinTracking" , false , " If true, divide tpcInnerParam by the electric charge" };
276281
277282 struct : o2::framework::ConfigurableGroup {
@@ -287,6 +292,12 @@ struct DeuteronInTriggeredEvents {
287292 Configurable<int > tpcNClsMin{" tpcNClsMin" , 80 , " Minimum number of TPC clusters" };
288293 Configurable<float > tpcRigidityMin{" tpcRigidityMin" , 0 .5f , " Minimum TPC rigidity for tracks" };
289294 Configurable<LabeledArray<double >> tpcNSigmaMax{" tpcNSigmaMax" , {nuclei::NSigmaTPCdefault[0 ], 5 , 2 , nuclei::names, nuclei::nSigmaConfigName}, " TPC nsigma selection for light nuclei" };
295+ // Part related to ITS cut
296+ Configurable<bool > applyItsPid{" applyItsPid" , false , " Apply ITS PID" };
297+ Configurable<bool > setMCDefaultParams{" setMCDefaultParams" , false , " Use params in MC ITS PID" };
298+ Configurable<float > ptMaxItsPid{" ptMaxItsPid" , 1.0 , " Max pt for ITS PID" };
299+ Configurable<float > nSigmaItsMin{" nSigmaItsMin" , -3.0 , " Min nsigma in ITS" };
300+ Configurable<float > nSigmaItsMax{" nSigmaItsMax" , 3.0 , " Max nsigma in ITS" };
290301 } cfgTrackCut;
291302
292303 Configurable<float > cfgCutPtMinTree{" cfgCutPtMinTree" , 0 .2f , " Minimum track transverse momentum for tree saving" };
@@ -303,6 +314,8 @@ struct DeuteronInTriggeredEvents {
303314 Configurable<int > cfgFillGenSecondaries{" cfgFillGenSecondaries" , 0 , " Fill generated secondaries (0: no, 1: only weak decays, 2: all of them)" };
304315 Configurable<LabeledArray<int >> cfgDCAHists{" cfgDCAHists" , {nuclei::DCAHistDefault[0 ], 5 , 2 , nuclei::names, nuclei::dcaConfigNames}, " DCA hist configuration" };
305316
317+ Configurable<bool > cfgRemoveTOFtrack{" cfgRemoveTOFtrack" , false , " Remove TOF tracks with TPC PID incorrect" };
318+ Configurable<float > cfgNsigmaTPCvetoLF{" cfgNsigmaTPCvetoLF" , 3 .f , " TPC nsigma cut for tracks compatible with light flavor hadrons" };
306319 Configurable<double > cfgNsigmaTPCcutDCAhists{" cfgNsigmaTPCcutDCAhists" , 3 ., " TPC nsigma cut for DCA hists" };
307320 Configurable<double > cfgDeltaTOFmassCutDCAhists{" cfgDeltaTOFmassCutDCAhists" , 0.2 , " Delta TOF mass cut for DCA hists" };
308321 Configurable<double > cfgNsigmaTPCcutTOFhists{" cfgNsigmaTPCcutTOFhists" , 3 ., " TPC nsigma cut for TOF analysis" };
@@ -351,7 +364,7 @@ struct DeuteronInTriggeredEvents {
351364 // Utility object for jet background subtraction methods
352365 JetBkgSubUtils backgroundSub;
353366
354- using TrackCandidates = soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra, aod::TOFSignal, aod::TOFEvTime, aod::Tracks, aod::TrackSelection, aod::TrackSelectionExtension, aod::TracksDCA>;
367+ using TrackCandidates = soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra, aod::TOFSignal, aod::TOFEvTime, aod::Tracks, aod::TrackSelection, aod::TrackSelectionExtension, aod::TracksDCA, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr >;
355368
356369 HistogramRegistry spectra{" spectra" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
357370
@@ -473,6 +486,11 @@ struct DeuteronInTriggeredEvents {
473486 ccdb->setLocalObjectValidityChecking ();
474487 ccdb->setFatalWhenNull (false );
475488
489+ // Set default MC parametrization for ITS response
490+ if (cfgTrackCut.setMCDefaultParams ) {
491+ itsResponse.setMCDefaultParameters ();
492+ }
493+
476494 const AxisSpec nSigmaAxes[2 ]{{cfgNsigmaTPCbins, " n#sigma_{TPC}" }, {cfgNsigmaTOFbins, " n#sigma_{TOF}" }};
477495 const AxisSpec tofMassAxis{cfgTOFmassBins, " TOF mass - PDG mass" };
478496 const AxisSpec ptResAxis{cfgMomResBins, " #Delta#it{p}_{T}/#it{p}_{T}" };
@@ -525,6 +543,7 @@ struct DeuteronInTriggeredEvents {
525543 spectra.add (" hTpcSignalData" , " Specific energy loss" , HistType::kTH2F , {{600 , -6 ., 6 ., " #it{p} (GeV/#it{c})" }, {1400 , 0 , 1400 , " d#it{E} / d#it{X} (a. u.)" }});
526544 spectra.add (" hTpcSignalDataSelected" , " Specific energy loss for selected particles" , HistType::kTH2F , {{600 , -6 ., 6 ., " #it{p} (GeV/#it{c})" }, {1400 , 0 , 1400 , " d#it{E} / d#it{X} (a. u.)" }});
527545 spectra.add (" hTofSignalData" , " TOF beta" , HistType::kTH2F , {{500 , 0 ., 5 ., " #it{p} (GeV/#it{c})" }, {750 , 0 , 1.5 , " TOF #beta" }});
546+ spectra.add (" hItsNsigmaDeuteron" , " n#sigma_{ITS}" , HistType::kTH2F , {{1000 , 0 ., 5 ., " #it{p}_{T} (GeV/#it{c})" }, {600 , -6 ., 6 ., " n#sigma_{ITS}" }});
528547
529548 for (unsigned int iC{0 }; iC < nuclei::matter.size (); ++iC) {
530549 nuclei::hGloTOFtracks[iC] = spectra.add <TH2 >(fmt::format (" hTPCTOFtracks{}" , nuclei::matter[iC]).data (), fmt::format (" Global vs TOF matched {} tracks in a collision" , nuclei::chargeLabelNames[iC]).data (), HistType::kTH2D , {{300 , -0.5 , 300.5 , " Number of global tracks" }, {300 , -0.5 , 300.5 , " Number of TOF matched tracks" }});
@@ -781,7 +800,16 @@ struct DeuteronInTriggeredEvents {
781800 track.itsChi2NCl () > cfgTrackCut.itsChi2ClusMax ) {
782801 continue ;
783802 }
784- // temporary fix: tpcInnerParam() returns the momentum in all the software tags before --- CM: what does it mean
803+
804+ double nSigmaIts = static_cast <double >(itsResponse.nSigmaITS <o2::track::PID ::Deuteron>(track));
805+ spectra.fill (HIST (" hItsNsigmaDeuteron" ), track.pt (), nSigmaIts);
806+
807+ // ITS Logic for PID Selection
808+ if (cfgTrackCut.applyItsPid && track.pt () < cfgTrackCut.ptMaxItsPid && (nSigmaIts < cfgTrackCut.nSigmaItsMin || nSigmaIts > cfgTrackCut.nSigmaItsMax )) {
809+ continue ;
810+ }
811+
812+ // temporary fix: tpcInnerParam() returns the momentum in all the software tags before
785813 bool heliumPID = track.pidForTracking () == o2::track::PID ::Helium3 || track.pidForTracking () == o2::track::PID ::Alpha;
786814 float correctedTpcInnerParam = (heliumPID && cfgCompensatePIDinTracking) ? track.tpcInnerParam () / 2 : track.tpcInnerParam ();
787815
@@ -799,6 +827,7 @@ struct DeuteronInTriggeredEvents {
799827
800828 bool selectedTPC[5 ]{false }, goodToAnalyse{false };
801829 std::array<float , 5 > nSigmaTPC;
830+
802831 // This part apply a selection on tracks:
803832 // if the nsigma of the track is less than a certain value, it is accepted
804833 for (int iS{0 }; iS < nuclei::Species; ++iS) { // The first index here is set to 0 because it is TPC analysis
@@ -844,6 +873,15 @@ struct DeuteronInTriggeredEvents {
844873 flag |= kITSrof ;
845874 }
846875
876+ // Part for identifying tracks which are compatible to proton, kaons and pions
877+ bool isCompatibleWithLF{false };
878+ double nSigmaTpcPion = track.tpcNSigmaPi ();
879+ double nSigmaTpcKaon = track.tpcNSigmaKa ();
880+ double nSigmaTpcProt = track.tpcNSigmaPr ();
881+
882+ if (cfgRemoveTOFtrack && (std::abs (nSigmaTpcPion) < cfgNsigmaTPCvetoLF || std::abs (nSigmaTpcKaon) < cfgNsigmaTPCvetoLF || std::abs (nSigmaTpcProt) < cfgNsigmaTPCvetoLF))
883+ isCompatibleWithLF = true ;
884+
847885 for (int iS{0 }; iS < nuclei::Species; ++iS) {
848886 bool selectedTOF{false };
849887 if (std::abs (dcaInfo[1 ]) > cfgTrackCut.dcaMax ->get (iS, 1 )) {
@@ -870,7 +908,7 @@ struct DeuteronInTriggeredEvents {
870908 nuclei::hNsigma[iPID][iS][iC]->Fill (fvector.pt (), nSigma[iPID][iS]);
871909 nuclei::hNsigmaEta[iPID][iS][iC]->Fill (fvector.eta (), fvector.pt (), nSigma[iPID][iS]);
872910 }
873- if (iPID && std::abs (nSigmaTPC[iS]) < cfgNsigmaTPCcutTOFhists) { // Apply nsigmaTPC cut on TOF tracks
911+ if (iPID && std::abs (nSigmaTPC[iS]) < cfgNsigmaTPCcutTOFhists && !isCompatibleWithLF ) { // Apply nsigmaTPC cut on TOF tracks
874912 nuclei::hTOFmass[iS][iC]->Fill (fvector.pt (), tofMasses[iS]);
875913 nuclei::hTOFmassEta[iS][iC]->Fill (fvector.eta (), fvector.pt (), tofMasses[iS]);
876914 }
@@ -994,15 +1032,15 @@ struct DeuteronInTriggeredEvents {
9941032 std::vector<bool > isReconstructed (particlesMC.size (), false );
9951033 for (auto & c : nuclei::candidates) { // o2-linter: disable=const-ref-in-for-loop (candidate is modified in loop)
9961034 auto label = tracks.iteratorAt (c.globalIndex );
997- if (label.mcParticleId () < - 1 || label.mcParticleId () >= particlesMC.size ()) {
1035+ if (label.mcParticleId () < 0 || label.mcParticleId () >= particlesMC.size ()) {
9981036 continue ;
9991037 }
10001038 auto particle = particlesMC.iteratorAt (label.mcParticleId ());
10011039 bool storeIt{false };
10021040 for (int iS{0 }; iS < nuclei::Species; ++iS) {
10031041 if (std::abs (particle.pdgCode ()) == nuclei::Codes[iS]) {
10041042 if (c.fillTree && !storeIt) {
1005- nuclei::hMomRes[iS][particle.pdgCode () < 0 ]->Fill (1 ., std::abs (c.pt * nuclei::Charges[iS]), 1 . - std::abs (c.pt * nuclei::Charges[iS]) / particle.pt ());
1043+ nuclei::hMomRes[iS][particle.pdgCode () < 0 ]->Fill (std::abs (c.pt * nuclei::Charges[iS]), 1 . - std::abs (c.pt * nuclei::Charges[iS]) / particle.pt ());
10061044 storeIt = cfgTreeConfig->get (iS, 0u ) || cfgTreeConfig->get (iS, 1u ); // / store only the particles of interest
10071045 }
10081046 auto coll = collisions.iteratorAt (c.collTrackIndex );
@@ -1071,7 +1109,7 @@ struct DeuteronInTriggeredEvents {
10711109 float motherDecRadius = -1 ;
10721110 if (particle.isPhysicalPrimary ()) {
10731111 flags |= kIsPhysicalPrimary ;
1074- nuclei::hGenNuclei[iS][particle.pdgCode () < 0 ]->Fill (1 ., particle.pt ());
1112+ nuclei::hGenNuclei[iS][particle.pdgCode () < 0 ]->Fill (particle.pt ());
10751113 // antinuclei from B hadrons are classified as physical primaries
10761114 if (particle.has_mothers ()) {
10771115 for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
@@ -1142,7 +1180,7 @@ struct DeuteronInTriggeredEvents {
11421180 if (c.fillTree ) {
11431181 auto label = tracks.iteratorAt (c.globalIndex );
11441182
1145- if (label.mcParticleId () < - 1 || label.mcParticleId () >= particlesMC.size ()) {
1183+ if (label.mcParticleId () < 0 || label.mcParticleId () >= particlesMC.size ()) {
11461184 continue ;
11471185 }
11481186
0 commit comments