2020#include " PWGCF/DataModel/CorrelationsDerived.h"
2121#include " PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h"
2222#include " PWGMM/Mult/DataModel/bestCollisionTable.h"
23+ #include " PWGUD/Core/SGSelector.h"
2324
2425#include " Common/Core/RecoDecay.h"
2526#include " Common/Core/TrackSelection.h"
@@ -77,12 +78,19 @@ using namespace o2::constants::math;
7778struct LongrangecorrDerived {
7879
7980 SliceCache cache;
81+ SGSelector sgSelector;
8082 HistogramRegistry histos{" histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
8183 Configurable<int > cfgNmixedevent{" cfgNmixedevent" , 5 , " how many events are mixed" };
8284 Configurable<int > cfgPidMask{" cfgPidMask" , 0 , " Selection bitmask for the TPC particle" };
8385 Configurable<int > cfgV0Mask{" cfgV0Mask" , 0 , " Selection bitmask for the V0 particle" };
8486 Configurable<float > cfgVtxCut{" cfgVtxCut" , 10 .0f , " Vertex Z range to consider" };
8587
88+ Configurable<float > cfgFv0Cut{" cfgFv0Cut" , 50 .0f , " FV0A threshold" };
89+ Configurable<float > cfgFt0aCut{" cfgFt0aCut" , 100 .0f , " FT0A threshold" };
90+ Configurable<float > cfgFt0cCut{" cfgFt0cCut" , 50 .0f , " FT0C threshold" };
91+ Configurable<float > cfgZdcCut{" cfgZdcCut" , 0 .1f , " ZDC threshold" };
92+ Configurable<int > cfgGapSideCut{" cfgGapSideCut" , 0 , " Gap-side A=0, C=1, AC = 2, No Gap = -1, All events = 3" };
93+
8694 ConfigurableAxis axisMultiplicity{" axisMultiplicity" , {VARIABLE_WIDTH, 0 , 10 , 15 , 25 , 50 , 60 , 1000 }, " multiplicity axis" };
8795 ConfigurableAxis axisPhi{" axisPhi" , {96 , 0 , TwoPI}, " #phi axis" };
8896 ConfigurableAxis axisEtaTrig{" axisEtaTrig" , {40 , -1 ., 1 .}, " #eta trig axis" };
@@ -111,13 +119,28 @@ struct LongrangecorrDerived {
111119 using MftbestTrksTable = aod::MftBestTrkLRTables;
112120 using V0TrksTable = aod::V0TrkLRTables;
113121
122+ using UpcCollsTable = soa::Join<aod::UpcCollLRTables, aod::UpcSgCollLRTables, aod::ZdcLRTables>;
123+ using TrksUpcTable = aod::TrkLRUpcTables;
124+ using MftTrksUpcTable = aod::MftTrkLRUpcTables;
125+ using Ft0aTrksUpcTable = aod::Ft0aLRUpcTables;
126+ using Ft0cTrksUpcTable = aod::Ft0cLRUpcTables;
127+ using MftbestTrksUpcTable = aod::MftBestTrkLRUpcTables;
128+ using V0TrksUpcTable = aod::V0TrkLRUpcTables;
129+
114130 Preslice<TrksTable> perColTpc = aod::lrcorrtrktable::collLRTableId;
115131 Preslice<MftTrksTable> perColMft = aod::lrcorrtrktable::collLRTableId;
116132 Preslice<MftbestTrksTable> perColMftbest = aod::lrcorrtrktable::collLRTableId;
117133 Preslice<Ft0aTrksTable> perColFt0a = aod::lrcorrtrktable::collLRTableId;
118134 Preslice<Ft0cTrksTable> perColFt0c = aod::lrcorrtrktable::collLRTableId;
119135 Preslice<V0TrksTable> perColV0 = aod::lrcorrtrktable::collLRTableId;
120136
137+ Preslice<TrksUpcTable> perUpcColTpc = aod::lrcorrtrktable::upcCollLRTableId;
138+ Preslice<MftTrksUpcTable> perUpcColMft = aod::lrcorrtrktable::upcCollLRTableId;
139+ Preslice<MftbestTrksUpcTable> perUpcColMftbest = aod::lrcorrtrktable::upcCollLRTableId;
140+ Preslice<Ft0aTrksUpcTable> perUpcColFt0a = aod::lrcorrtrktable::upcCollLRTableId;
141+ Preslice<Ft0cTrksUpcTable> perUpcColFt0c = aod::lrcorrtrktable::upcCollLRTableId;
142+ Preslice<V0TrksUpcTable> perUpcColV0 = aod::lrcorrtrktable::upcCollLRTableId;
143+
121144 void init (InitContext const &)
122145 {
123146 std::vector<AxisSpec> corrAxis = {{axisVtxZ, " z-vtx (cm)" },
@@ -135,9 +158,12 @@ struct LongrangecorrDerived {
135158 mixed.setObject (new CorrelationContainer (" mixedEvent" , " mixedEvent" , corrAxis, effAxis, userAxis));
136159
137160 histos.add (" hMultiplicity" , " hMultiplicity" , kTH1D , {axisMultiplicity});
138- histos.add (" hCentrality" , " hCentrality" , kTH1D , {axisMultiplicity});
139161 histos.add (" hVertexZ" , " hVertexZ" , kTH1D , {axisVtxZ});
140162
163+ histos.add (" hGapSide" , " hGapSide" , kTH1I , {{5 , -0.5 , 4.5 }});
164+ histos.add (" hTrueGapSide" , " hTrueGapSide" , kTH1I , {{6 , -1.5 , 4.5 }});
165+ histos.add (" hTrueGapSide_AfterSel" , " hTrueGapSide_AfterSel" , kTH1I , {{6 , -1.5 , 4.5 }});
166+
141167 histos.add (" Trig_eta" , " Trig_eta" , kTH1D , {axisEtaTrig});
142168 histos.add (" Trig_phi" , " Trig_phi" , kTH1D , {axisPhi});
143169 histos.add (" Trig_etavsphi" , " Trig_etavsphi" , kTH2D , {axisPhi, axisEtaTrig});
@@ -157,7 +183,6 @@ struct LongrangecorrDerived {
157183 void fillCollQA (TCollision const & col)
158184 {
159185 histos.fill (HIST (" hMultiplicity" ), col.multiplicity ());
160- histos.fill (HIST (" hCentrality" ), col.centrality ());
161186 histos.fill (HIST (" hVertexZ" ), col.zvtx ());
162187 }
163188
@@ -178,12 +203,32 @@ struct LongrangecorrDerived {
178203 histos.fill (HIST (" Assoc_phi" ), track.phi ());
179204 }
180205
206+ template <bool fillHist = true , typename CheckCol>
207+ bool isUpcEventSelected (CheckCol const & col)
208+ {
209+ if constexpr (fillHist) {
210+ histos.fill (HIST (" hGapSide" ), col.gapSide ());
211+ }
212+ int truegapSide = sgSelector.trueGap (col, cfgFv0Cut, cfgFt0aCut, cfgFt0cCut, cfgZdcCut);
213+ if constexpr (fillHist) {
214+ histos.fill (HIST (" hTrueGapSide" ), truegapSide);
215+ }
216+ if (truegapSide != cfgGapSideCut)
217+ return false ;
218+ if constexpr (fillHist) {
219+ histos.fill (HIST (" hTrueGapSide_AfterSel" ), truegapSide);
220+ }
221+ return true ;
222+ }
223+
181224 template <class T >
182225 using HasTpcTrack = decltype (std::declval<T&>().trackType());
183226 template <class T >
184227 using HasV0Track = decltype (std::declval<T&>().v0Type());
185228 template <class T >
186229 using HasInvMass = decltype (std::declval<T&>().invMass());
230+ template <class T >
231+ using HasUpc = decltype (std::declval<T&>().gapSide());
187232
188233 template <CorrelationContainer::CFStep step, typename TTarget, typename TTriggers, typename TAssocs>
189234 void fillCorrHist (TTarget target, TTriggers const & triggers, TAssocs const & assocs, bool mixing, float vz, float multiplicity, float eventWeight)
@@ -233,20 +278,31 @@ struct LongrangecorrDerived {
233278 } // process same
234279
235280 template <typename TCollision, typename ... TrackTypes>
236- void processMixed (TCollision const & col , TrackTypes&&... tracks)
281+ void processMixed (TCollision const & cols , TrackTypes&&... tracks)
237282 {
238- auto getMultiplicity = [this ](auto & collision) {
239- (void )this ;
240- return collision.multiplicity ();
283+ auto getMultiplicity = [this ](auto & col) {
284+ if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
285+ if (!isUpcEventSelected<false >(col)) {
286+ return -1 .0f ;
287+ }
288+ } else {
289+ (void )this ;
290+ }
291+ return col.multiplicity ();
241292 };
242293 using MixedBinning = FlexibleBinningPolicy<std::tuple<decltype (getMultiplicity)>, aod::lrcorrcolltable::Zvtx, decltype (getMultiplicity)>;
243294 MixedBinning binningOnVtxAndMult{{getMultiplicity}, {axisVtxZME, axisMultME}, true };
244295 auto tracksTuple = std::make_tuple (std::forward<TrackTypes>(tracks)...);
245296 using TupleAtrack = std::tuple_element<0 , decltype (tracksTuple)>::type;
246297 using TupleBtrack = std::tuple_element<std::tuple_size_v<decltype (tracksTuple)> - 1 , decltype (tracksTuple)>::type;
247- Pair<TCollision, TupleAtrack, TupleBtrack, MixedBinning> pairs{binningOnVtxAndMult, cfgNmixedevent, -1 , col , tracksTuple, &cache};
298+ Pair<TCollision, TupleAtrack, TupleBtrack, MixedBinning> pairs{binningOnVtxAndMult, cfgNmixedevent, -1 , cols , tracksTuple, &cache};
248299 for (auto it = pairs.begin (); it != pairs.end (); it++) {
249300 auto & [col1, tracks1, col2, tracks2] = *it;
301+ if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
302+ if (!isUpcEventSelected<false >(col1) || !isUpcEventSelected<false >(col2)) {
303+ continue ;
304+ }
305+ }
250306 float eventweight = 1 .0f / it.currentWindowNeighbours ();
251307 fillCorrHist<CorrelationContainer::kCFStepReconstructed >(mixed, tracks1, tracks2, true , col1.zvtx (), col1.multiplicity (), eventweight);
252308 } // pair loop
@@ -342,6 +398,123 @@ struct LongrangecorrDerived {
342398 processMixed (cols, tracks, mfts);
343399 }
344400
401+ void processUpcTpcft0aSE (UpcCollsTable::iterator const & col, TrksUpcTable const & tracks, Ft0aTrksUpcTable const & ft0as)
402+ {
403+ if (!isUpcEventSelected<true >(col)) {
404+ return ;
405+ }
406+ processSame (col, tracks, ft0as);
407+ }
408+
409+ void processUpcTpcft0cSE (UpcCollsTable::iterator const & col, TrksUpcTable const & tracks, Ft0cTrksUpcTable const & ft0cs)
410+ {
411+ if (!isUpcEventSelected<true >(col)) {
412+ return ;
413+ }
414+ processSame (col, tracks, ft0cs);
415+ }
416+
417+ void processUpcTpcmftSE (UpcCollsTable::iterator const & col, TrksUpcTable const & tracks, MftTrksUpcTable const & mfts)
418+ {
419+ if (!isUpcEventSelected<true >(col)) {
420+ return ;
421+ }
422+ processSame (col, tracks, mfts);
423+ }
424+
425+ void processUpcMftft0aSE (UpcCollsTable::iterator const & col, MftTrksUpcTable const & mfts, Ft0aTrksUpcTable const & ft0as)
426+ {
427+ if (!isUpcEventSelected<true >(col)) {
428+ return ;
429+ }
430+ processSame (col, mfts, ft0as);
431+ }
432+
433+ void processUpcV0ft0aSE (UpcCollsTable::iterator const & col, V0TrksUpcTable const & tracks, Ft0aTrksUpcTable const & ft0as)
434+ {
435+ if (!isUpcEventSelected<true >(col)) {
436+ return ;
437+ }
438+ processSame (col, tracks, ft0as);
439+ }
440+
441+ void processUpcV0mftSE (UpcCollsTable::iterator const & col, V0TrksUpcTable const & tracks, MftTrksUpcTable const & mfts)
442+ {
443+ if (!isUpcEventSelected<true >(col)) {
444+ return ;
445+ }
446+ processSame (col, tracks, mfts);
447+ }
448+
449+ void processUpcTpcmftbestSE (UpcCollsTable::iterator const & col, TrksUpcTable const & tracks, MftbestTrksUpcTable const & mfts)
450+ {
451+ if (!isUpcEventSelected<true >(col)) {
452+ return ;
453+ }
454+ processSame (col, tracks, mfts);
455+ }
456+
457+ void processUpcMftbestft0aSE (UpcCollsTable::iterator const & col, MftbestTrksUpcTable const & mfts, Ft0aTrksUpcTable const & ft0as)
458+ {
459+ if (!isUpcEventSelected<true >(col)) {
460+ return ;
461+ }
462+ processSame (col, mfts, ft0as);
463+ }
464+
465+ void processUpcV0mftbestSE (UpcCollsTable::iterator const & col, V0TrksUpcTable const & tracks, MftbestTrksUpcTable const & mfts)
466+ {
467+ if (!isUpcEventSelected<true >(col)) {
468+ return ;
469+ }
470+ processSame (col, tracks, mfts);
471+ }
472+
473+ void processUpcTpcft0aME (UpcCollsTable const & cols, TrksUpcTable const & tracks, Ft0aTrksUpcTable const & ft0as)
474+ {
475+ processMixed (cols, tracks, ft0as);
476+ }
477+
478+ void processUpcTpcft0cME (UpcCollsTable const & cols, TrksUpcTable const & tracks, Ft0cTrksUpcTable const & ft0cs)
479+ {
480+ processMixed (cols, tracks, ft0cs);
481+ }
482+
483+ void processUpcTpcmftME (UpcCollsTable const & cols, TrksUpcTable const & tracks, MftTrksUpcTable const & mfts)
484+ {
485+ processMixed (cols, tracks, mfts);
486+ }
487+
488+ void processUpcMftft0aME (UpcCollsTable const & cols, MftTrksUpcTable const & mfts, Ft0aTrksUpcTable const & ft0as)
489+ {
490+ processMixed (cols, mfts, ft0as);
491+ }
492+
493+ void processUpcV0ft0aME (UpcCollsTable const & cols, V0TrksUpcTable const & tracks, Ft0aTrksUpcTable const & ft0as)
494+ {
495+ processMixed (cols, tracks, ft0as);
496+ }
497+
498+ void processUpcV0mftME (UpcCollsTable const & cols, V0TrksUpcTable const & tracks, MftTrksUpcTable const & mfts)
499+ {
500+ processMixed (cols, tracks, mfts);
501+ }
502+
503+ void processUpcTpcmftbestME (UpcCollsTable const & cols, TrksUpcTable const & tracks, MftbestTrksUpcTable const & mfts)
504+ {
505+ processMixed (cols, tracks, mfts);
506+ }
507+
508+ void processUpcMftbestft0aME (UpcCollsTable const & cols, MftbestTrksUpcTable const & mfts, Ft0aTrksUpcTable const & ft0as)
509+ {
510+ processMixed (cols, mfts, ft0as);
511+ }
512+
513+ void processUpcV0mftbestME (UpcCollsTable const & cols, V0TrksUpcTable const & tracks, MftbestTrksUpcTable const & mfts)
514+ {
515+ processMixed (cols, tracks, mfts);
516+ }
517+
345518 PROCESS_SWITCH (LongrangecorrDerived, processTpcft0aSE, " same event TPC vs FT0A" , false );
346519 PROCESS_SWITCH (LongrangecorrDerived, processTpcft0aME, " mixed event TPC vs FT0A" , false );
347520 PROCESS_SWITCH (LongrangecorrDerived, processTpcft0cSE, " same event TPC vs FT0C" , false );
@@ -360,6 +533,24 @@ struct LongrangecorrDerived {
360533 PROCESS_SWITCH (LongrangecorrDerived, processMftbestft0aME, " mixed event best MFT vs FT0A" , false );
361534 PROCESS_SWITCH (LongrangecorrDerived, processV0mftbestSE, " same event V0 vs best MFT" , false );
362535 PROCESS_SWITCH (LongrangecorrDerived, processV0mftbestME, " mixed event V0 vs best MFT" , false );
536+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcft0aSE, " same UPC event TPC vs FT0A" , false );
537+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcft0aME, " mixed UPC event TPC vs FT0A" , false );
538+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcft0cSE, " same UPC event TPC vs FT0C" , false );
539+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcft0cME, " mixed UPC event TPC vs FT0C" , false );
540+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcmftSE, " same UPC event TPC vs MFT" , false );
541+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcmftME, " mixed UPC event TPC vs MFT" , false );
542+ PROCESS_SWITCH (LongrangecorrDerived, processUpcMftft0aSE, " same UPC event MFT vs FT0A" , false );
543+ PROCESS_SWITCH (LongrangecorrDerived, processUpcMftft0aME, " mixed UPC event MFT vs FT0A" , false );
544+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0ft0aSE, " same UPC event V0 vs FT0A" , false );
545+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0ft0aME, " mixed UPC event V0 vs FT0A" , false );
546+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0mftSE, " same UPC event V0 vs MFT" , false );
547+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0mftME, " mixed UPC event V0 vs MFT" , false );
548+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcmftbestSE, " same UPC event TPC vs best MFT" , false );
549+ PROCESS_SWITCH (LongrangecorrDerived, processUpcTpcmftbestME, " mixed UPC event TPC vs best MFT" , false );
550+ PROCESS_SWITCH (LongrangecorrDerived, processUpcMftbestft0aSE, " same UPC event best MFT vs FT0A" , false );
551+ PROCESS_SWITCH (LongrangecorrDerived, processUpcMftbestft0aME, " mixed UPC event best MFT vs FT0A" , false );
552+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0mftbestSE, " same UPC event V0 vs best MFT" , false );
553+ PROCESS_SWITCH (LongrangecorrDerived, processUpcV0mftbestME, " mixed UPC event V0 vs best MFT" , false );
363554};
364555
365556WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments