1414// / \since Apr/2/2026
1515// / \brief flow efficiency analysis on UPC MC
1616
17- #include " PWGUD/Core/SGSelector.h"
17+ // #include "PWGUD/Core/SGSelector.h"
1818#include " PWGUD/DataModel/UDTables.h"
1919
2020#include " Common/Core/RecoDecay.h"
@@ -81,6 +81,7 @@ struct FlowMcUpc {
8181 histos.add <TH1>(" mcEventCounter" , " Monte Carlo Truth EventCounter" , HistType::kTH1F , {{5 , 0 , 5 }});
8282 histos.add <TH1>(" RecoProcessEventCounter" , " Reconstruction EventCounter" , HistType::kTH1F , {{5 , 0 , 5 }});
8383 histos.add <TH1>(" hImpactParameter" , " hImpactParameter" , HistType::kTH1D , {axisB});
84+ histos.add <TH1>(" RecoProcessTrackCounter" , " Reconstruction TrackCounter" , HistType::kTH1F , {{5 , 0 , 5 }});
8485
8586 histos.add <TH1>(" hPtMCGen" , " Monte Carlo Truth; pT (GeV/c);" , {HistType::kTH1D , {axisPt}});
8687 histos.add <TH3>(" hEtaPtVtxzMCGen" , " Monte Carlo Truth; #eta; p_{T} (GeV/c); V_{z} (cm);" , {HistType::kTH3D , {axisEta, axisPt, axisVertex}});
@@ -97,6 +98,10 @@ struct FlowMcUpc {
9798 template <typename TTrack>
9899 bool trackSelected (TTrack const & track)
99100 {
101+ if (!track.hasTPC ())
102+ return false ;
103+ if (!track.isPVContributor ())
104+ return false ;
100105 // auto momentum = std::array<double, 3>{track.px(), track.py(), track.pz()};
101106 auto pt = track.pt ();
102107 if (pt < cfgPtCutMin || pt > cfgPtCutMax) {
@@ -151,51 +156,70 @@ struct FlowMcUpc {
151156 PROCESS_SWITCH (FlowMcUpc, processMCTrue, " process pure simulation information" , true );
152157
153158 using MCRecoTracks = soa::Join<aod::UDTracks, aod::UDTracksPID, aod::UDTracksExtra, aod::UDTracksFlags, aod::UDTracksDCA, aod::UDMcTrackLabels>;
154- using MCRecoCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionSelExtras, aod:: UDCollisionsSels, aod::UDZdcsReduced , aod::UDMcCollsLabels>;
159+ using MCRecoCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::UDMcCollsLabels>;
155160
156161 // PresliceUnsorted<MCRecoTracks> trackPerMcParticle = aod::udmctracklabel::udMcParticleId;
157162 Preslice<MCRecoTracks> trackPerCollision = aod::udtrack::udCollisionId; // sorted preslice used because the pair track-collision is already sorted in processDataSG function
158163
159- void processReco (MCRecoCollisions const & collisions, MCRecoTracks const & tracks)
164+ void processReco (MCRecoCollisions const & collisions, MCRecoTracks const & tracks, aod::UDMcParticles const & mcParticles )
160165 {
166+ // std::cout << "process reco" << std::endl;
161167 for (const auto & collision : collisions) {
168+ Partition<MCRecoTracks> pvContributors = aod::udtrack::isPVContributor == true ;
169+ pvContributors.bindTable (tracks);
170+ // std::cout << "collision loop" << std::endl;
162171 histos.fill (HIST (" RecoProcessEventCounter" ), 0.5 );
163172 // if (!eventSelected(collision))
164173 // return;
165174 histos.fill (HIST (" RecoProcessEventCounter" ), 1.5 );
166- if (!collision.has_udMcCollision ())
167- return ;
175+ // if (!collision.has_udMcCollision())
176+ // return;
168177 histos.fill (HIST (" RecoProcessEventCounter" ), 2.5 );
169- if (tracks.size () < 1 )
170- return ;
171178 histos.fill (HIST (" RecoProcessEventCounter" ), 3.5 );
172179
173180 float vtxz = collision.posZ ();
174181
175- auto const & tempTracks = tracks.sliceBy (trackPerCollision, static_cast <int64_t >(collision.globalIndex ()));
182+ // auto const& tempTracks = tracks.sliceBy(trackPerCollision, static_cast<int64_t>(collision.globalIndex()));
183+ // std::cout << "sliced" << std::endl;
176184
177- for (const auto & track : tempTracks) {
185+ for (const auto & track : tracks) {
186+ histos.fill (HIST (" RecoProcessTrackCounter" ), 0.5 );
187+ // std::cout << "track loop" << std::endl;
178188 // focus on bulk: e, mu, pi, k, p
179189 auto momentum = std::array<double , 3 >{track.px (), track.py (), track.pz ()};
180190 double pt = RecoDecay::pt (momentum);
181191 double eta = RecoDecay::eta (momentum);
182192 // double phi = RecoDecay::phi(momentum);
183193 if (!trackSelected (track) || (!track.has_udMcParticle ()))
184194 continue ;
195+ histos.fill (HIST (" RecoProcessTrackCounter" ), 1.5 );
196+ // std::cout << "track selected" << std::endl;
185197 auto mcParticle = track.udMcParticle ();
198+ // std::cout << "mc particle" << std::endl;
186199 int pdgCode = std::abs (mcParticle.pdgCode ());
200+ // std::cout << "pdg code" << std::endl;
187201
188202 // double pt = recoMC.Pt();
189203 // double eta = recoMC.Eta();
190- if (pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != PDG_t::kKPlus && pdgCode != PDG_t::kProton )
204+ if (pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != PDG_t::kKPlus && pdgCode != PDG_t::kProton ) {
205+ // std::cout << "pdg code not in list" << std::endl;
191206 continue ;
192- if (std::fabs (eta) > cfgCutEta) // main acceptance
207+ }
208+ histos.fill (HIST (" RecoProcessTrackCounter" ), 2.5 );
209+ if (std::fabs (eta) > cfgCutEta) {
210+ // std::cout << "cfgcuteta" << std::endl;
193211 continue ;
194- if (!mcParticle.isPhysicalPrimary ())
212+ } // main acceptance
213+ histos.fill (HIST (" RecoProcessTrackCounter" ), 3.5 );
214+ if (!mcParticle.isPhysicalPrimary ()) {
215+ // std::cout << "not physical primary" << std::endl;
195216 continue ;
217+ }
218+ histos.fill (HIST (" RecoProcessTrackCounter" ), 4.5 );
196219
197220 histos.fill (HIST (" hPtReco" ), pt);
198221 histos.fill (HIST (" hEtaPtVtxzMCReco" ), eta, pt, vtxz);
222+ // std::cout << "first loop end" << std::endl;
199223 }
200224 }
201225 }
0 commit comments