@@ -150,70 +150,90 @@ struct flowTest {
150150
151151 using LabeledCascades = soa::Join<aod::CascDataExt, aod::McCascLabels>;
152152
153- void processCascade (aod::McParticle const & mcParticle, soa::SmallGroups< LabeledCascades> const & cascades, recoTracks const &, aod::McCollisions const &)
153+ void processCascade (aod::McParticles const & mcParticles, LabeledCascades const & cascades, recoTracks const &, aod::McCollisions const &)
154154 {
155- auto mcCollision = mcParticle.mcCollision ();
156- float imp = mcCollision.impactParameter ();
155+ std::vector<bool > isRecoed;
156+ isRecoed.resize (mcParticles.size (), false );
157+ for (auto const & cascade : cascades) {
158+ if (cascade.has_mcParticle ()) {
159+ isRecoed[cascade.mcParticleId ()] = true ;
160+ }
161+ }
162+
163+ for (auto const & mcParticle : mcParticles) {
164+ auto mcCollision = mcParticle.mcCollision ();
165+ float imp = mcCollision.impactParameter ();
157166
158- int pdgCode = TMath::Abs (mcParticle.pdgCode ());
159- if (pdgCode != 3312 && pdgCode != 3334 )
160- return ;
161-
162- if (!mcParticle.isPhysicalPrimary ())
163- return ;
164- if (TMath::Abs (mcParticle.eta ()) > 0.8 )
165- return ;
166-
167- float deltaPhi = mcParticle.phi () - mcCollision.eventPlaneAngle ();
168- if (deltaPhi < 0 )
169- deltaPhi += 2 . * TMath::Pi ();
170- if (deltaPhi > 2 . * TMath::Pi ())
171- deltaPhi -= 2 . * TMath::Pi ();
172- if (pdgCode == 3312 )
173- histos.fill (HIST (" hBVsPtVsPhiGeneratedXi" ), imp, deltaPhi, mcParticle.pt ());
174- if (pdgCode == 3334 )
175- histos.fill (HIST (" hBVsPtVsPhiGeneratedOmega" ), imp, deltaPhi, mcParticle.pt ());
176-
177- if (cascades.size () > 0 ) {
167+ int pdgCode = TMath::Abs (mcParticle.pdgCode ());
168+ if (pdgCode != 3312 && pdgCode != 3334 )
169+ return ;
170+
171+ if (!mcParticle.isPhysicalPrimary ())
172+ return ;
173+ if (TMath::Abs (mcParticle.eta ()) > 0.8 )
174+ return ;
175+
176+ float deltaPhi = mcParticle.phi () - mcCollision.eventPlaneAngle ();
177+ if (deltaPhi < 0 )
178+ deltaPhi += 2 . * TMath::Pi ();
179+ if (deltaPhi > 2 . * TMath::Pi ())
180+ deltaPhi -= 2 . * TMath::Pi ();
178181 if (pdgCode == 3312 )
179- histos.fill (HIST (" hBVsPtVsPhiGlobalXi " ), imp, deltaPhi, mcParticle.pt ());
182+ histos.fill (HIST (" hBVsPtVsPhiGeneratedXi " ), imp, deltaPhi, mcParticle.pt ());
180183 if (pdgCode == 3334 )
181- histos.fill (HIST (" hBVsPtVsPhiGlobalOmega" ), imp, deltaPhi, mcParticle.pt ());
184+ histos.fill (HIST (" hBVsPtVsPhiGeneratedOmega" ), imp, deltaPhi, mcParticle.pt ());
185+
186+ if (isRecoed[mcParticle.globalIndex ()]) {
187+ if (pdgCode == 3312 )
188+ histos.fill (HIST (" hBVsPtVsPhiGlobalXi" ), imp, deltaPhi, mcParticle.pt ());
189+ if (pdgCode == 3334 )
190+ histos.fill (HIST (" hBVsPtVsPhiGlobalOmega" ), imp, deltaPhi, mcParticle.pt ());
191+ }
182192 }
183193 }
184194 PROCESS_SWITCH (flowTest, processCascade, " Process cascades" , true );
185195
186196 using LabeledV0s = soa::Join<aod::V0Datas, aod::McV0Labels>;
187197
188- void processV0s (aod::McParticle const & mcParticle, soa::SmallGroups< LabeledV0s> const & v0s, recoTracks const &, aod::McCollisions const &)
198+ void processV0s (aod::McParticles const & mcParticles, LabeledV0s const & v0s, recoTracks const &, aod::McCollisions const &)
189199 {
190- auto mcCollision = mcParticle.mcCollision ();
191- float imp = mcCollision.impactParameter ();
200+ std::vector<bool > isRecoed;
201+ isRecoed.resize (mcParticles.size (), false );
202+ for (auto const & v0 : v0s) {
203+ if (v0.has_mcParticle ()) {
204+ isRecoed[v0.mcParticleId ()] = true ;
205+ }
206+ }
207+
208+ for (auto const & mcParticle : mcParticles) {
209+ auto mcCollision = mcParticle.mcCollision ();
210+ float imp = mcCollision.impactParameter ();
192211
193- int pdgCode = TMath::Abs (mcParticle.pdgCode ());
194- if (pdgCode != 310 && pdgCode != 3122 )
195- return ;
196-
197- if (!mcParticle.isPhysicalPrimary ())
198- return ;
199- if (TMath::Abs (mcParticle.eta ()) > 0.8 )
200- return ;
201-
202- float deltaPhi = mcParticle.phi () - mcCollision.eventPlaneAngle ();
203- if (deltaPhi < 0 )
204- deltaPhi += 2 . * TMath::Pi ();
205- if (deltaPhi > 2 . * TMath::Pi ())
206- deltaPhi -= 2 . * TMath::Pi ();
207- if (pdgCode == 310 )
208- histos.fill (HIST (" hBVsPtVsPhiGeneratedK0Short" ), imp, deltaPhi, mcParticle.pt ());
209- if (pdgCode == 3122 )
210- histos.fill (HIST (" hBVsPtVsPhiGeneratedLambda" ), imp, deltaPhi, mcParticle.pt ());
211-
212- if (v0s.size () > 0 ) {
212+ int pdgCode = TMath::Abs (mcParticle.pdgCode ());
213+ if (pdgCode != 310 && pdgCode != 3122 )
214+ return ;
215+
216+ if (!mcParticle.isPhysicalPrimary ())
217+ return ;
218+ if (TMath::Abs (mcParticle.eta ()) > 0.8 )
219+ return ;
220+
221+ float deltaPhi = mcParticle.phi () - mcCollision.eventPlaneAngle ();
222+ if (deltaPhi < 0 )
223+ deltaPhi += 2 . * TMath::Pi ();
224+ if (deltaPhi > 2 . * TMath::Pi ())
225+ deltaPhi -= 2 . * TMath::Pi ();
213226 if (pdgCode == 310 )
214- histos.fill (HIST (" hBVsPtVsPhiGlobalK0Short " ), imp, deltaPhi, mcParticle.pt ());
227+ histos.fill (HIST (" hBVsPtVsPhiGeneratedK0Short " ), imp, deltaPhi, mcParticle.pt ());
215228 if (pdgCode == 3122 )
216- histos.fill (HIST (" hBVsPtVsPhiGlobalLambda" ), imp, deltaPhi, mcParticle.pt ());
229+ histos.fill (HIST (" hBVsPtVsPhiGeneratedLambda" ), imp, deltaPhi, mcParticle.pt ());
230+
231+ if (isRecoed[mcParticle.globalIndex ()]) {
232+ if (pdgCode == 310 )
233+ histos.fill (HIST (" hBVsPtVsPhiGlobalK0Short" ), imp, deltaPhi, mcParticle.pt ());
234+ if (pdgCode == 3122 )
235+ histos.fill (HIST (" hBVsPtVsPhiGlobalLambda" ), imp, deltaPhi, mcParticle.pt ());
236+ }
217237 }
218238 }
219239 PROCESS_SWITCH (flowTest, processV0s, " Process V0s" , true );
0 commit comments