@@ -184,9 +184,11 @@ struct HfCorrelatorD0Hadrons {
184184 Configurable<float > multMin{" multMin" , 0 ., " minimum multiplicity accepted" };
185185 Configurable<float > multMax{" multMax" , 10000 ., " maximum multiplicity accepted" };
186186 Configurable<float > ptSoftPionMax{" ptSoftPionMax" , 3 * 800 . * pow (10 ., -6 .), " max. pT cut for soft pion identification" };
187+ Configurable<bool > correlateD0WithLeadingParticle{" correlateD0WithLeadingParticle" , false , " Switch for correlation of D0 mesons with leading particle only" };
187188
188189 HfHelper hfHelper;
189190
191+ int leadingIndex = 0 ;
190192 double massD0{0 .};
191193 double massPi{0 .};
192194 double massK{0 .};
@@ -264,6 +266,22 @@ struct HfCorrelatorD0Hadrons {
264266 registry.add (" hCountD0TriggersGen" , " D0 trigger particles - MC gen;;N of trigger D0" , {HistType::kTH2F , {{1 , -0.5 , 0.5 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
265267 }
266268
269+ // Find Leading Particle
270+ template <typename TTracks>
271+ int findLeadingParticle (TTracks const & tracks)
272+ {
273+ auto leadingParticle = tracks.begin ();
274+ for (auto const & track : tracks) {
275+ if (std::abs (track.dcaXY ()) >= 1 . || std::abs (track.dcaZ ()) >= 1 .) {
276+ continue ;
277+ }
278+ if (track.pt () > leadingParticle.pt ()) {
279+ leadingParticle = track;
280+ }
281+ }
282+ int leadingIndex = leadingParticle.globalIndex ();
283+ return leadingIndex;
284+ }
267285 // ======= Process starts for Data, Same event ============
268286
269287 // / D0-h correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
@@ -275,6 +293,11 @@ struct HfCorrelatorD0Hadrons {
275293 if (selectedD0Candidates.size () == 0 ) {
276294 return ;
277295 }
296+ // find leading particle
297+ if (correlateD0WithLeadingParticle) {
298+ leadingIndex = findLeadingParticle (tracks);
299+ }
300+
278301 int poolBin = corrBinning.getBin (std::make_tuple (collision.posZ (), collision.multFV0M ()));
279302 int nTracks = 0 ;
280303 if (collision.numContrib () > 1 ) {
@@ -383,6 +406,12 @@ struct HfCorrelatorD0Hadrons {
383406 signalStatus += aod::hf_correlation_d0_hadron::ParticleTypeData::D0barOnly;
384407 }
385408
409+ if (correlateD0WithLeadingParticle) {
410+ if (track.globalIndex () != leadingIndex) {
411+ continue ;
412+ }
413+ registry.fill (HIST (" hTrackCounter" ), 4 ); // fill no. of tracks have leading particle
414+ }
386415 entryD0HadronPair (getDeltaPhi (track.phi (), candidate1.phi ()),
387416 track.eta () - candidate1.eta (),
388417 candidate1.pt (),
0 commit comments