@@ -63,6 +63,7 @@ struct hstrangecorrelationfilter {
6363 // Track quality
6464 Configurable<int > minTPCNCrossedRows{" minTPCNCrossedRows" , 70 , " Minimum TPC crossed rows" };
6565 Configurable<bool > triggerRequireITS{" triggerRequireITS" , true , " require ITS signal in trigger tracks" };
66+ Configurable<bool > assocRequireITS{" assocRequireITS" , true , " require ITS signal in assoc tracks" };
6667 Configurable<int > triggerMaxTPCSharedClusters{" triggerMaxTPCSharedClusters" , 200 , " maximum number of shared TPC clusters (inclusive)" };
6768 Configurable<bool > triggerRequireL0{" triggerRequireL0" , false , " require ITS L0 cluster for trigger" };
6869
@@ -136,17 +137,21 @@ struct hstrangecorrelationfilter {
136137
137138 using V0LinkedTagged = soa::Join<aod::V0sLinked, aod::V0Tags>;
138139 using CascadesLinkedTagged = soa::Join<aod::CascadesLinked, aod::CascTags>;
140+ using FullTracks = soa::Join<aod::Tracks, aod::TracksExtra>;
141+ using FullTracksMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::McTrackLabels>;
139142 using DauTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::TracksDCA>;
140143 using DauTracksMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::TracksDCA, aod::McTrackLabels>;
141144 // using IDTracks= soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidBayesPi, aod::pidBayesKa, aod::pidBayesPr, aod::TOFSignal>; // prepared for Bayesian PID
142- using IDTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPr, aod::pidTOFFullPr, aod::TOFSignal, aod::TracksDCA>;
145+ using IDTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPr, aod::pidTOFFullPr, aod::pidTPCFullEl, aod::pidTOFFullEl, aod::TOFSignal, aod::TracksDCA>;
146+ using IDTracksMC = soa::Join<aod::Tracks, aod::TracksExtra, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPr, aod::pidTOFFullPr, aod::pidTPCFullEl, aod::pidTOFFullEl, aod::TOFSignal, aod::TracksDCA, aod::McTrackLabels>;
143147 using V0DatasWithoutTrackX = soa::Join<aod::V0Indices, aod::V0Cores>;
144148
145149 Produces<aod::TriggerTracks> triggerTrack;
146- Produces<aod::AssocPions> assocPion ;
150+ Produces<aod::TriggerTrackExtras> triggerTrackExtra ;
147151 Produces<aod::AssocV0s> assocV0;
148152 Produces<aod::AssocCascades> assocCascades;
149153 Produces<aod::AssocHadrons> assocHadrons;
154+ Produces<aod::AssocPID> assocPID;
150155
151156 TF1* fK0Mean = new TF1(" fK0Mean" , " [0]+[1]*x+[2]*TMath::Exp(-[3]*x)" );
152157 TF1* fK0Width = new TF1(" fK0Width" , " [0]+[1]*x+[2]*TMath::Exp(-[3]*x)" );
@@ -221,9 +226,83 @@ struct hstrangecorrelationfilter {
221226 }
222227 return true ;
223228 }
229+ template <class TTrack >
230+ bool isValidAssocTrack (TTrack assoc)
231+ {
232+ if (assoc.eta () > assocEtaMax || assoc.eta () < assocEtaMin) {
233+ return false ;
234+ }
235+ if (assoc.pt () > assocPtCutMax || assoc.pt () < assocPtCutMin) {
236+ return false ;
237+ }
238+ if (assoc.tpcNClsCrossedRows () < minTPCNCrossedRows) {
239+ return false ; // crossed rows
240+ }
241+ if (!assoc.hasITS () && assocRequireITS) {
242+ return false ; // skip, doesn't have ITS signal (skips lots of TPC-only!)
243+ }
244+
245+ // do this only if information is available
246+ float nSigmaTPCTOF[8 ] = {-10 , -10 , -10 , -10 , -10 , -10 , -10 , -10 };
247+ if constexpr (requires { assoc.tofSignal (); }) {
248+ if (assoc.tofSignal () > 0 ) {
249+ if (std::sqrt (assoc.tofNSigmaPi () * assoc.tofNSigmaPi () + assoc.tpcNSigmaPi () * assoc.tpcNSigmaPi ()) > assocPionNSigmaTPCFOF)
250+ return false ;
251+ if (assoc.tofNSigmaPr () < rejectSigma)
252+ return false ;
253+ if (assoc.tpcNSigmaPr () < rejectSigma)
254+ return false ;
255+ if (assoc.tofNSigmaKa () < rejectSigma)
256+ return false ;
257+ if (assoc.tpcNSigmaKa () < rejectSigma)
258+ return false ;
259+ nSigmaTPCTOF[4 ] = assoc.tofNSigmaPi ();
260+ nSigmaTPCTOF[5 ] = assoc.tofNSigmaKa ();
261+ nSigmaTPCTOF[6 ] = assoc.tofNSigmaPr ();
262+ nSigmaTPCTOF[7 ] = assoc.tofNSigmaEl ();
263+ } else {
264+ if (assoc.tpcNSigmaPi () > assocPionNSigmaTPCFOF)
265+ return false ;
266+ if (assoc.tpcNSigmaPr () < rejectSigma)
267+ return false ;
268+ if (assoc.tpcNSigmaKa () < rejectSigma)
269+ return false ;
270+ }
271+ nSigmaTPCTOF[0 ] = assoc.tpcNSigmaPi ();
272+ nSigmaTPCTOF[1 ] = assoc.tpcNSigmaKa ();
273+ nSigmaTPCTOF[2 ] = assoc.tpcNSigmaPr ();
274+ nSigmaTPCTOF[3 ] = assoc.tpcNSigmaEl ();
275+ }
276+
277+ bool physicalPrimary = false ;
278+ float origPt = -1 ;
279+ if constexpr (requires { assoc.mcParticle (); }) {
280+ if (assoc.has_mcParticle ()) {
281+ auto mcParticle = assoc.mcParticle ();
282+ physicalPrimary = mcParticle.isPhysicalPrimary ();
283+ origPt = mcParticle.pt ();
284+ }
285+ }
286+
287+ assocHadrons (
288+ assoc.collisionId (),
289+ physicalPrimary,
290+ assoc.globalIndex (),
291+ origPt);
292+ assocPID (
293+ nSigmaTPCTOF[0 ],
294+ nSigmaTPCTOF[1 ],
295+ nSigmaTPCTOF[2 ],
296+ nSigmaTPCTOF[3 ],
297+ nSigmaTPCTOF[4 ],
298+ nSigmaTPCTOF[5 ],
299+ nSigmaTPCTOF[6 ],
300+ nSigmaTPCTOF[7 ]);
301+ return true ;
302+ }
224303
225304 // for real data processing
226- void processTriggers (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<DauTracks > const & tracks, aod::BCsWithTimestamps const &)
305+ void processTriggers (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<FullTracks > const & tracks, aod::BCsWithTimestamps const &)
227306 {
228307 // Perform basic event selection
229308 if (!collision.sel8 ()) {
@@ -252,11 +331,12 @@ struct hstrangecorrelationfilter {
252331 false , // if you decide to check real data for primaries, you'll have a hard time
253332 track.globalIndex (),
254333 0 );
334+ triggerTrackExtra (1 );
255335 }
256336 }
257337
258338 // for MC processing
259- void processTriggersMC (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<DauTracksMC > const & tracks, aod::McParticles const &, aod::BCsWithTimestamps const &)
339+ void processTriggersMC (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<FullTracksMC > const & tracks, aod::McParticles const &, aod::BCsWithTimestamps const &)
260340 {
261341 // Perform basic event selection
262342 if (!collision.sel8 ()) {
@@ -292,6 +372,7 @@ struct hstrangecorrelationfilter {
292372 physicalPrimary,
293373 track.globalIndex (),
294374 origPt);
375+ triggerTrackExtra (1 );
295376 }
296377 }
297378
@@ -317,59 +398,12 @@ struct hstrangecorrelationfilter {
317398 // / _________________________________________________
318399 // / Step 1: Populate table with trigger tracks
319400 for (auto const & track : tracks) {
320- if (track. eta () > assocEtaMax || track. eta () < assocEtaMin) {
401+ if (! isValidAssocTrack ( track))
321402 continue ;
322- }
323- // if (track.sign()= 1 ) {continue;}
324- if (track.pt () > assocPtCutMax || track.pt () < assocPtCutMin) {
325- continue ;
326- }
327- if (track.tpcNClsCrossedRows () < minTPCNCrossedRows) {
328- continue ; // crossed rows
329- }
330- if (!track.hasITS () && triggerRequireITS) {
331- continue ; // skip, doesn't have ITS signal (skips lots of TPC-only!)
332- }
333- // prepared for Bayesian PID
334- // if (!track.bayesPi() > pionMinBayesProb) {
335- // continue;
336- // }
337- // if (track.bayesPi() < track.bayesPr() || track.bayesPi() < track.bayesKa()){
338- // continue;
339- // }
340- // if (track.tpcNSigmaPi() < assocPionNSigmaTPCFOF){
341- // continue;
342- // }
343- // if (track.tofSignal() > 0 && track.tofNSigmaPi() < assocPionNSigmaTPCFOF){
344- // continue;
345- // }
346- if (track.tofSignal () > 0 ) {
347- if (std::sqrt (track.tofNSigmaPi () * track.tofNSigmaPi () + track.tpcNSigmaPi () * track.tpcNSigmaPi ()) > assocPionNSigmaTPCFOF)
348- continue ;
349- if (track.tofNSigmaPr () < rejectSigma)
350- continue ;
351- if (track.tpcNSigmaPr () < rejectSigma)
352- continue ;
353- if (track.tofNSigmaKa () < rejectSigma)
354- continue ;
355- if (track.tpcNSigmaKa () < rejectSigma)
356- continue ;
357- } else {
358- if (track.tpcNSigmaPi () > assocPionNSigmaTPCFOF)
359- continue ;
360- if (track.tpcNSigmaPr () < rejectSigma)
361- continue ;
362- if (track.tpcNSigmaKa () < rejectSigma)
363- continue ;
364- }
365-
366- assocHadrons (
367- track.collisionId (),
368- track.globalIndex ());
369403 }
370404 }
371405
372- void processAssocHadrons (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA> > const & tracks, aod::BCsWithTimestamps const &)
406+ void processAssocPionsMC (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<IDTracksMC > const & tracks, aod::BCsWithTimestamps const &)
373407 {
374408 // Perform basic event selection
375409 if (!collision.sel8 ()) {
@@ -391,23 +425,61 @@ struct hstrangecorrelationfilter {
391425 // / _________________________________________________
392426 // / Step 1: Populate table with trigger tracks
393427 for (auto const & track : tracks) {
394- if (track. eta () > assocEtaMax || track. eta () < assocEtaMin) {
428+ if (! isValidAssocTrack ( track))
395429 continue ;
430+ }
431+ }
432+
433+ void processAssocHadrons (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<FullTracks> const & tracks, aod::BCsWithTimestamps const &)
434+ {
435+ // Perform basic event selection
436+ if (!collision.sel8 ()) {
437+ return ;
438+ }
439+ // No need to correlate stuff that's in far collisions
440+ if (TMath::Abs (collision.posZ ()) > 10.0 ) {
441+ return ;
442+ }
443+ if (zorroMask.value != " " ) {
444+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
445+ initCCDB (bc);
446+ bool zorroSelected = zorro.isSelected (collision.bc_as <aod::BCsWithTimestamps>().globalBC ()); // / Just let Zorro do the accounting
447+ if (!zorroSelected) {
448+ return ;
396449 }
397- // if (track.sign()= 1 ) {continue;}
398- if (track.pt () > assocPtCutMax || track.pt () < assocPtCutMin) {
450+ }
451+
452+ // / _________________________________________________
453+ // / Step 1: Populate table with trigger tracks
454+ for (auto const & track : tracks) {
455+ if (!isValidAssocTrack (track))
399456 continue ;
457+ }
458+ }
459+ void processAssocHadronsMC (soa::Join<aod::Collisions, aod::EvSels>::iterator const & collision, soa::Filtered<FullTracksMC> const & tracks, aod::BCsWithTimestamps const &)
460+ {
461+ // Perform basic event selection
462+ if (!collision.sel8 ()) {
463+ return ;
464+ }
465+ // No need to correlate stuff that's in far collisions
466+ if (TMath::Abs (collision.posZ ()) > 10.0 ) {
467+ return ;
468+ }
469+ if (zorroMask.value != " " ) {
470+ auto bc = collision.bc_as <aod::BCsWithTimestamps>();
471+ initCCDB (bc);
472+ bool zorroSelected = zorro.isSelected (collision.bc_as <aod::BCsWithTimestamps>().globalBC ()); // / Just let Zorro do the accounting
473+ if (!zorroSelected) {
474+ return ;
400475 }
401- if (track.tpcNClsCrossedRows () < minTPCNCrossedRows) {
402- continue ; // crossed rows
403- }
404- if (!track.hasITS () && triggerRequireITS) {
405- continue ; // skip, doesn't have ITS signal (skips lots of TPC-only!)
406- }
476+ }
407477
408- assocHadrons (
409- track.collisionId (),
410- track.globalIndex ());
478+ // / _________________________________________________
479+ // / Step 1: Populate table with trigger tracks
480+ for (auto const & track : tracks) {
481+ if (!isValidAssocTrack (track))
482+ continue ;
411483 }
412484 }
413485
@@ -600,9 +672,11 @@ struct hstrangecorrelationfilter {
600672 PROCESS_SWITCH (hstrangecorrelationfilter, processTriggers, " Produce trigger tables" , true );
601673 PROCESS_SWITCH (hstrangecorrelationfilter, processTriggersMC, " Produce trigger tables for MC" , false );
602674 PROCESS_SWITCH (hstrangecorrelationfilter, processV0s, " Produce associated V0 tables" , true );
603- PROCESS_SWITCH (hstrangecorrelationfilter, processAssocPions, " Produce associated Pion tables" , true );
675+ PROCESS_SWITCH (hstrangecorrelationfilter, processAssocPions, " Produce associated Pion tables" , false );
676+ PROCESS_SWITCH (hstrangecorrelationfilter, processAssocPionsMC, " Produce associated Pion tables for MC" , false );
604677 PROCESS_SWITCH (hstrangecorrelationfilter, processCascades, " Produce associated cascade tables" , true );
605678 PROCESS_SWITCH (hstrangecorrelationfilter, processAssocHadrons, " Produce associated Hadron tables" , true );
679+ PROCESS_SWITCH (hstrangecorrelationfilter, processAssocHadronsMC, " Produce associated Hadron tables for MC" , false );
606680};
607681
608682WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments