@@ -60,6 +60,9 @@ using namespace o2::aod::rctsel;
6060
6161auto static constexpr kMinCharge = 3 .f;
6262auto static constexpr kNumDecay = 4 ;
63+ auto static constexpr kIntZero = 0 ;
64+ auto static constexpr kZero = 0 .f;
65+ auto static constexpr kIntOne = 1 ;
6366
6467enum TrkSel {
6568 trkSelAll,
@@ -72,11 +75,14 @@ enum TrkSel {
7275 nTrkSel
7376};
7477
75- enum TrkAmbSel {
76- trkSelAmbiguousAll,
77- trkSelWoAmbiguous,
78- trkSelNumReassoc,
79- nTrkAmbSel
78+ enum TrkBestSel {
79+ trkBestSelAll,
80+ trkBestSelCollID,
81+ trkBestSelDCAxyCut,
82+ trkBestSelDCAzCut,
83+ trkBestSelWoAmbiguous,
84+ trkBestSelNumReassoc,
85+ nTrkBestSel
8086};
8187
8288struct DndetaMFTPbPb {
@@ -100,8 +106,7 @@ struct DndetaMFTPbPb {
100106 Configurable<bool > cfgUseIRCut{" cfgUseIRCut" , false , " Flag to cut on IR rate" };
101107 Configurable<bool > cfgIRCrashOnNull{" cfgIRCrashOnNull" , false , " Flag to avoid CTP RateFetcher crash" };
102108 Configurable<std::string> cfgIRSource{" cfgIRSource" , " ZNC hadronic" , " Estimator of the interaction rate (Pb-Pb: ZNC hadronic)" };
103- Configurable<bool > cfgUseTrackSel{" cfgUseTrackSel" , false , " Flag to apply track selection" };
104- Configurable<bool > cfgUseParticleSel{" cfgUseParticleSel" , false , " Flag to apply particle selection" };
109+ Configurable<bool > cfgUseTrackSel{" cfgUseTrackSel" , false , " Flag to apply track selection" }; Configurable<bool > cfgUseParticleSel{" cfgUseParticleSel" , false , " Flag to apply particle selection" };
105110
106111 struct : ConfigurableGroup {
107112 ConfigurableAxis interactionRateBins{" interactionRateBins" , {500 , 0 , 50 }, " Binning for the interaction rate (kHz)" };
@@ -288,10 +293,13 @@ struct DndetaMFTPbPb {
288293 hev->GetXaxis ()->SetBinLabel (13 , " Above max occup." );
289294 hev->GetXaxis ()->SetBinLabel (14 , " RCT Flag Checker" );
290295
291- registry.add (" Tracks/hAmbTrkSel" , " Number of ambiguous tracks; Cut; #Tracks Passed Cut" , {HistType::kTH1F , {{nTrkAmbSel, -0.5 , +nTrkAmbSel - 0.5 }}});
292- registry.get <TH1>(HIST (" Tracks/hAmbTrkSel" ))->GetXaxis ()->SetBinLabel (trkSelAmbiguousAll + 1 , " All" );
293- registry.get <TH1>(HIST (" Tracks/hAmbTrkSel" ))->GetXaxis ()->SetBinLabel (trkSelWoAmbiguous + 1 , " No Ambiguous" );
294- registry.get <TH1>(HIST (" Tracks/hAmbTrkSel" ))->GetXaxis ()->SetBinLabel (trkSelNumReassoc + 1 , " Reassociated" );
296+ registry.add (" Tracks/hBestTrkSel" , " Number of best tracks; Cut; #Tracks Passed Cut" , {HistType::kTH1F , {{nTrkBestSel, -0.5 , +nTrkBestSel - 0.5 }}});
297+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelAll + 1 , " All" );
298+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelCollID + 1 , " Assigned (ID>=0)" );
299+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelDCAxyCut + 1 , " DCA xy cut" );
300+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelDCAzCut + 1 , " DCA z cut" );
301+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelWoAmbiguous + 1 , " No Ambiguous" );
302+ registry.get <TH1>(HIST (" Tracks/hBestTrkSel" ))->GetXaxis ()->SetBinLabel (trkBestSelNumReassoc + 1 , " Reassociated" );
295303
296304 registry.add (" Tracks/hTrkSel" , " Number of tracks; Cut; #Tracks Passed Cut" , {HistType::kTH1F , {{nTrkSel, -0.5 , +nTrkSel - 0.5 }}});
297305 registry.get <TH1>(HIST (" Tracks/hTrkSel" ))->GetXaxis ()->SetBinLabel (trkSelAll + 1 , " All" );
@@ -811,10 +819,10 @@ struct DndetaMFTPbPb {
811819 qaregistry.add ({" Tracks/hDCAxyBestGenSecMat" , " ; DCA_{xy}^{gen} (cm); counts" , {HistType::kTH1F , {dcaxyAxis}}});
812820 qaregistry.add ({" Tracks/hDCAzBestGenSecMat" , " ; DCA_{z}^{gen} (cm); counts" , {HistType::kTH1F , {dcazAxis}}});
813821 //
814- qaregistry.add ({" Tracks/hDCAxyBestPtRec" , " ; p_{T} (GeV/c) ; DCA_{XY} (cm)" , {HistType::kTH2F , {ptAxis, dcaxyAxis}}});
815- qaregistry.add ({" Tracks/hDCAzBestPtRec" , " ; p_{T} (GeV/c) ; DCA_{Z} (cm)" , {HistType::kTH2F , {ptAxis, dcazAxis}}});
816- qaregistry.add ({" Tracks/hDCAxyBestRec" , " ; DCA_{XY} (cm)" , {HistType::kTH1F , {dcaxyAxis}}});
817- qaregistry.add ({" Tracks/hDCAzBestRec" , " ; DCA_{Z} (cm)" , {HistType::kTH1F , {dcazAxis}}});
822+ qaregistry.add ({" Tracks/hDCAxyBestPtRec" ," ; p_{T} (GeV/c) ; DCA_{XY} (cm)" , {HistType::kTH2F , {ptAxis, dcaxyAxis}}});
823+ qaregistry.add ({" Tracks/hDCAzBestPtRec" ," ; p_{T} (GeV/c) ; DCA_{Z} (cm)" , {HistType::kTH2F , {ptAxis, dcazAxis}}});
824+ qaregistry.add ({" Tracks/hDCAxyBestRec" ," ; DCA_{XY} (cm)" , {HistType::kTH1F , {dcaxyAxis}}});
825+ qaregistry.add ({" Tracks/hDCAzBestRec" ," ; DCA_{Z} (cm)" , {HistType::kTH1F , {dcazAxis}}});
818826 }
819827 if (doprocessDCAMcCentFT0C) {
820828 qaregistry.add ({" Tracks/Centrality/hDCAxBestGenPrim" , " ; DCA_{x}^{gen} (cm); counts" , {HistType::kTH1F , {dcaxyAxis}}});
@@ -832,17 +840,17 @@ struct DndetaMFTPbPb {
832840 qaregistry.add ({" Tracks/Centrality/hDCAxyBestGenSecMat" , " ; DCA_{xy}^{gen} (cm); counts" , {HistType::kTH1F , {dcaxyAxis}}});
833841 qaregistry.add ({" Tracks/Centrality/hDCAzBestGenSecMat" , " ; DCA_{z}^{gen} (cm); counts" , {HistType::kTH1F , {dcazAxis}}});
834842 //
835- qaregistry.add ({" Tracks/Centrality/hDCAxyBestPtRec" , " ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality" , {HistType::kTHnSparseF , {ptAxis, dcaxyAxis, centralityAxis}}});
836- qaregistry.add ({" Tracks/Centrality/hDCAzBestPtRec" , " ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality" , {HistType::kTHnSparseF , {ptAxis, dcazAxis, centralityAxis}}});
837- qaregistry.add ({" Tracks/Centrality/hDCAxyBestRec" , " ; DCA_{XY} (cm); centrality" , {HistType::kTH2F , {dcaxyAxis, centralityAxis}}});
838- qaregistry.add ({" Tracks/Centrality/hDCAzBestRec" , " ; DCA_{Z} (cm); centrality" , {HistType::kTH2F , {dcazAxis, centralityAxis}}});
843+ qaregistry.add ({" Tracks/Centrality/hDCAxyBestPtRec" ," ; p_{T} (GeV/c) ; DCA_{XY} (cm); centrality" , {HistType::kTHnSparseF , {ptAxis, dcaxyAxis, centralityAxis}}});
844+ qaregistry.add ({" Tracks/Centrality/hDCAzBestPtRec" ," ; p_{T} (GeV/c) ; DCA_{Z} (cm); centrality" , {HistType::kTHnSparseF , {ptAxis, dcazAxis, centralityAxis}}});
845+ qaregistry.add ({" Tracks/Centrality/hDCAxyBestRec" ," ; DCA_{XY} (cm); centrality" , {HistType::kTH2F , {dcaxyAxis, centralityAxis}}});
846+ qaregistry.add ({" Tracks/Centrality/hDCAzBestRec" ," ; DCA_{Z} (cm); centrality" , {HistType::kTH2F , {dcazAxis, centralityAxis}}});
839847 }
840848 }
841849
842850 // / Filters - tracks
843851 Filter filtTrkEta = (aod::fwdtrack::eta < trackCuts.maxEta) &&
844852 (aod::fwdtrack::eta > trackCuts.minEta);
845- Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= 0 );
853+ Filter filtATrackID = (aod::fwdtrack::bestCollisionId >= kIntZero );
846854 Filter filtATrackDCAxy = (nabs(aod::fwdtrack::bestDCAXY) < trackCuts.maxDCAxy);
847855 Filter filtATrackDCAz = (nabs(aod::fwdtrack::bestDCAZ) < trackCuts.maxDCAz);
848856
@@ -876,10 +884,37 @@ struct DndetaMFTPbPb {
876884 using FiltBestTracks = soa::Filtered<aod::BestCollisionsFwd3d>;
877885 using FiltParticles = soa::Filtered<aod::McParticles>;
878886
879- bool isHitAtDisk (uint16_t map, int ilayer)
887+ template <bool fillHis = true , typename B>
888+ bool isBestTrackSelected (const B& besttrack)
880889 {
881- LOGF (debug, " map %i --> %i" , map, (map >> (ilayer * 6 )) & 0x3F );
882- return (map >> (ilayer * 6 )) & 0x3F ;
890+ if (fillHis) {
891+ registry.fill (HIST (" Tracks/hBestTrkSel" ), trkBestSelAll);
892+ }
893+ if (besttrack.bestCollisionId () < kIntZero ) {
894+ return false ;
895+ }
896+ if constexpr (fillHis) {
897+ registry.fill (HIST (" Tracks/hBestTrkSel" ), trkBestSelCollID);
898+ }
899+ if (std::abs (besttrack.bestDCAXY ()) >= trackCuts.maxDCAxy ) {
900+ return false ;
901+ }
902+ if constexpr (fillHis) {
903+ registry.fill (HIST (" Tracks/hBestTrkSel" ), trkBestSelDCAxyCut);
904+ }
905+ if (std::abs (besttrack.bestDCAZ ()) >= trackCuts.maxDCAxy ) {
906+ return false ;
907+ }
908+ if constexpr (fillHis) {
909+ registry.fill (HIST (" Tracks/hBestTrkSel" ), trkBestSelDCAzCut);
910+ }
911+ if (trackCuts.excludeAmbiguous && besttrack.ambDegree () > kIntOne ) {
912+ return false ;
913+ }
914+ if (fillHis) {
915+ registry.fill (HIST (" Tracks/hBestTrkSel" ), trkBestSelWoAmbiguous);
916+ }
917+ return true ;
883918 }
884919
885920 template <bool fillHis = true , typename T>
@@ -993,15 +1028,9 @@ struct DndetaMFTPbPb {
9931028 ambiguousTrkIds.reserve (besttracks.size ());
9941029 reassignedTrkIds.reserve (besttracks.size ());
9951030 for (auto const & atrack : besttracks) {
996- if (fillHis) {
997- registry.fill (HIST (" Tracks/hAmbTrkSel" ), trkSelAmbiguousAll);
998- }
999- if (trackCuts.excludeAmbiguous && atrack.ambDegree () > 1 ) {
1031+ if (!isBestTrackSelected (atrack)) {
10001032 continue ;
10011033 }
1002- if (fillHis) {
1003- registry.fill (HIST (" Tracks/hAmbTrkSel" ), trkSelWoAmbiguous);
1004- }
10051034 auto itrack = atrack.template mfttrack_as <T>();
10061035 if (!isTrackSelected (itrack)) {
10071036 continue ;
@@ -1038,7 +1067,7 @@ struct DndetaMFTPbPb {
10381067 if (itrack.has_collision () && itrack.collisionId () != atrack.bestCollisionId ()) {
10391068 reassignedTrkIds.emplace_back (atrack.mfttrackId ());
10401069 if (fillHis) {
1041- registry.fill (HIST (" Tracks/hAmbTrkSel " ), trkSelNumReassoc );
1070+ registry.fill (HIST (" Tracks/hBestTrkSel " ), trkBestSelNumReassoc );
10421071 float phi = itrack.phi ();
10431072 o2::math_utils::bringTo02Pi (phi);
10441073 if (phi < 0 .f || TwoPI < phi) {
@@ -2157,7 +2186,7 @@ struct DndetaMFTPbPb {
21572186
21582187 for (auto const & track : besttracks) {
21592188 ambiguousTrkIdsMC.emplace_back (track.mfttrackId ());
2160- if (trackCuts. excludeAmbiguous && track. ambDegree () > 1 ) {
2189+ if (!isBestTrackSelected< false >(track) ) {
21612190 continue ;
21622191 }
21632192 auto itrack = track.mfttrack_as <FiltMcMftTracks>();
@@ -2172,12 +2201,12 @@ struct DndetaMFTPbPb {
21722201 if (itrack.eta () > trackCuts.minEta && itrack.eta () < trackCuts.maxEta ) {
21732202 if constexpr (has_reco_cent<C>) {
21742203 qaregistry.fill (HIST (" Tracks/Centrality/hPtPhiEtaZvtxEffBestRec" ),
2175- particle.pt (), particle.phi (), particle.eta (),
2176- mcCollision.posZ (), crec, occrec);
2204+ particle.pt (), particle.phi (), particle.eta (),
2205+ mcCollision.posZ (), crec, occrec);
21772206 } else {
21782207 qaregistry.fill (HIST (" Tracks/hPtPhiEtaZvtxEffBestRec" ), particle.pt (),
2179- particle.phi (), particle.eta (), mcCollision.posZ (),
2180- occrec);
2208+ particle.phi (), particle.eta (), mcCollision.posZ (),
2209+ occrec);
21812210 }
21822211 }
21832212 } else {
@@ -2204,12 +2233,12 @@ struct DndetaMFTPbPb {
22042233 if (track.eta () > trackCuts.minEta && track.eta () < trackCuts.maxEta ) {
22052234 if constexpr (has_reco_cent<C>) {
22062235 qaregistry.fill (HIST (" Tracks/Centrality/hPtPhiEtaZvtxEffBestRec" ),
2207- particle.pt (), particle.phi (), particle.eta (),
2208- mcCollision.posZ (), crec, occrec);
2236+ particle.pt (), particle.phi (), particle.eta (),
2237+ mcCollision.posZ (), crec, occrec);
22092238 } else {
22102239 qaregistry.fill (HIST (" Tracks/hPtPhiEtaZvtxEffBestRec" ), particle.pt (),
2211- particle.phi (), particle.eta (), mcCollision.posZ (),
2212- occrec);
2240+ particle.phi (), particle.eta (), mcCollision.posZ (),
2241+ occrec);
22132242 }
22142243 }
22152244 } else {
@@ -2350,7 +2379,7 @@ struct DndetaMFTPbPb {
23502379 if constexpr (has_reco_cent<C>) {
23512380 qaregistry.fill (HIST (" Tracks/Centrality/hMftTracksAmbDegreeWoTrivial" ), track.compatibleColl ().size (), c);
23522381 } else {
2353- qaregistry.fill (HIST (" Tracks/hMftTracksAmbDegreeWoTrivial" ), track.compatibleColl ().size ());
2382+ qaregistry.fill (HIST (" Tracks/hMftTracksAmbDegreeWoTrivial" ), track.compatibleColl ().size ());
23542383 }
23552384 continue ;
23562385 }
@@ -2428,10 +2457,10 @@ struct DndetaMFTPbPb {
24282457 // / @brief process template function for MC QA checks
24292458 template <typename C>
24302459 void processMcQA (typename soa::Join<C, aod::McCollisionLabels> const & collisions,
2431- MFTTracksLabeled const & tracks,
2432- aod::AmbiguousMFTTracks const & atracks,
2433- aod::McCollisions const & mcCollisions,
2434- FiltParticles const & /* particles*/ )
2460+ MFTTracksLabeled const & tracks,
2461+ aod::AmbiguousMFTTracks const & atracks,
2462+ aod::McCollisions const & mcCollisions,
2463+ FiltParticles const & /* particles*/ )
24352464 {
24362465 for (const auto & collision : collisions) {
24372466 float crec = getRecoCent (collision);
@@ -2500,14 +2529,15 @@ struct DndetaMFTPbPb {
25002529 PROCESS_SWITCH (DndetaMFTPbPb, processMcQACentFT0C,
25012530 " Process MC QA checks (in FT0 centrality bins)" , false );
25022531
2532+
25032533 // / @brief process template function for DCA MC checks
25042534 template <typename C, typename MC>
25052535 void processDCAMc (typename soa::Join<C, aod::McCollisionLabels>::iterator const & collision,
25062536 FiltMcMftTracks const & /* tracks*/ ,
25072537 soa::SmallGroups<aod::BestCollisionsFwd3d> const & besttracks,
25082538 MC const & /* mcCollisions*/ ,
25092539 aod::McParticles const & /* particles*/
2510- )
2540+ )
25112541 {
25122542 if (!isGoodEvent<false >(collision)) {
25132543 return ;
@@ -2566,8 +2596,8 @@ struct DndetaMFTPbPb {
25662596 const auto dcaZtruth (particle.vz () - particle.mcCollision ().posZ ());
25672597 auto dcaXYtruth = std::sqrt (dcaXtruth * dcaXtruth + dcaYtruth * dcaYtruth);
25682598
2569- if (!particle.isPhysicalPrimary ()) { // Secondaries (weak decays and material)
2570- if (particle.getProcess () == kNumDecay ) { // Particles from decay
2599+ if (!particle.isPhysicalPrimary ()) { // Secondaries (weak decays and material)
2600+ if (particle.getProcess () == kNumDecay ) { // Particles from decay
25712601 if constexpr (has_reco_cent<C>) {
25722602 qaregistry.fill (HIST (" Tracks/Centrality/hDCAxBestGenSecWeak" ), dcaXtruth, crec);
25732603 qaregistry.fill (HIST (" Tracks/Centrality/hDCAyBestGenSecWeak" ), dcaYtruth, crec);
@@ -2592,7 +2622,7 @@ struct DndetaMFTPbPb {
25922622 qaregistry.fill (HIST (" Tracks/hDCAzBestGenSecMat" ), dcaZtruth);
25932623 }
25942624 }
2595- } else { // Primaries
2625+ } else { // Primaries
25962626 if constexpr (has_reco_cent<C>) {
25972627 qaregistry.fill (HIST (" Tracks/Centrality/hDCAxBestGenPrim" ), dcaXtruth, crec);
25982628 qaregistry.fill (HIST (" Tracks/Centrality/hDCAyBestGenPrim" ), dcaYtruth, crec);
@@ -2609,10 +2639,11 @@ struct DndetaMFTPbPb {
26092639 }
26102640
26112641 void processDCAMcInlcusive (soa::Join<Colls, aod::McCollisionLabels>::iterator const & collision,
2612- FiltMcMftTracks const & tracks,
2613- soa::SmallGroups<aod::BestCollisionsFwd3d> const & besttracks,
2614- aod::McCollisions const & mccollisions,
2615- aod::McParticles const & particles)
2642+ FiltMcMftTracks const & tracks,
2643+ soa::SmallGroups<aod::BestCollisionsFwd3d> const & besttracks,
2644+ aod::McCollisions const & mccollisions,
2645+ aod::McParticles const & particles
2646+ )
26162647 {
26172648 processDCAMc<Colls, aod::McCollisions>(collision, tracks, besttracks, mccollisions, particles);
26182649 }
@@ -2623,7 +2654,8 @@ struct DndetaMFTPbPb {
26232654 FiltMcMftTracks const & tracks,
26242655 soa::SmallGroups<aod::BestCollisionsFwd3d> const & besttracks,
26252656 aod::McCollisions const & mccollisions,
2626- aod::McParticles const & particles)
2657+ aod::McParticles const & particles
2658+ )
26272659 {
26282660 processDCAMc<CollsCentFT0C, aod::McCollisions>(collision, tracks, besttracks, mccollisions, particles);
26292661 }
@@ -2639,7 +2671,7 @@ struct DndetaMFTPbPb {
26392671
26402672 auto nBestTrks = 0 ;
26412673 for (auto const & atrack : besttracks) {
2642- if (trackCuts. excludeAmbiguous && atrack. ambDegree () > 1 ) {
2674+ if (cfgUseTrackSel && !isBestTrackSelected< false >(atrack) ) {
26432675 continue ;
26442676 }
26452677 auto itrack = atrack.template mfttrack_as <FiltMftTracks>();
0 commit comments