2828#include " Common/Core/RecoDecay.h"
2929
3030#include " Common/DataModel/EventSelection.h"
31+ #include " Common/DataModel/Multiplicity.h"
3132#include " Common/DataModel/TrackSelectionTables.h"
3233#include " Common/DataModel/Centrality.h"
3334#include " PWGCF/DataModel/CorrelationsDerived.h"
@@ -54,39 +55,6 @@ DECLARE_SOA_TABLE(Multiplicity, "AOD", "MULTIPLICITY",
5455// define the filtered collisions and tracks
5556#define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
5657
57- struct CalcNch {
58- O2_DEFINE_CONFIGURABLE (cfgZVtxCut, float , 10 .0f , " Accepted z-vertex range" )
59- O2_DEFINE_CONFIGURABLE (cfgPtCutMin, float , 0 .2f , " minimum accepted track pT" )
60- O2_DEFINE_CONFIGURABLE (cfgPtCutMax, float , 10 .0f , " maximum accepted track pT" )
61- O2_DEFINE_CONFIGURABLE (cfgEtaCut, float , 10 .0f , " Eta cut" )
62- O2_DEFINE_CONFIGURABLE (cfgMinMixEventNum, int , 5 , " Minimum number of events to mix" )
63-
64- Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t ) true ));
65-
66- using AodCollisions = soa::Join<aod::Collisions, aod::EvSel>; // aod::CentFT0Cs
67- using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>>;
68-
69- Produces<aod::Multiplicity> multiplicityNch;
70-
71- HistogramRegistry registry{" registry" };
72-
73- void init (InitContext&)
74- {
75- AxisSpec axisNch = {100 , 0 , 100 };
76- AxisSpec axisVrtx = {10 , -10 , 10 };
77-
78- registry.add (" Ncharge" , " N_{charge}" , {HistType::kTH1D , {axisNch}});
79- registry.add (" zVtx_all" , " zVtx_all" , {HistType::kTH1D , {axisVrtx}});
80- }
81-
82- void process (AodCollisions::iterator const & collision, AodTracks const & tracks)
83- {
84- multiplicityNch (tracks.size ());
85- registry.fill (HIST (" Ncharge" ), tracks.size ());
86- registry.fill (HIST (" zVtx_all" ), collision.posZ ());
87- }
88- };
89-
9058struct CorrSparse {
9159 Service<ccdb::BasicCCDBManager> ccdb;
9260
@@ -100,13 +68,16 @@ struct CorrSparse {
10068 O2_DEFINE_CONFIGURABLE (cfgMergingCut, float , 0.0 , " Merging cut on track merge" )
10169 O2_DEFINE_CONFIGURABLE (cfgRadiusLow, float , 0.8 , " Low radius for merging cut" )
10270 O2_DEFINE_CONFIGURABLE (cfgRadiusHigh, float , 2.5 , " High radius for merging cut" )
103- O2_DEFINE_CONFIGURABLE (etaMftTrackMin, float , - 5.0 , " Minimum eta for MFT track" )
104- O2_DEFINE_CONFIGURABLE (etaMftTrackMax, float , 0.0 , " Maximum eta for MFT track" )
71+ O2_DEFINE_CONFIGURABLE (etaMftTrackMin, float , 3.6 , " Minimum eta for MFT track" )
72+ O2_DEFINE_CONFIGURABLE (etaMftTrackMax, float , 2.5 , " Maximum eta for MFT track" )
10573 O2_DEFINE_CONFIGURABLE (nClustersMftTrack, int , 5 , " Minimum number of clusters for MFT track" )
10674 O2_DEFINE_CONFIGURABLE (cfgSampleSize, double , 10 , " Sample size for mixed event" )
10775
10876 Configurable<bool > processMFT{" processMFT" , true , " Associate particle from MFT" };
10977
78+ SliceCache cache;
79+ SliceCache cacheNch;
80+
11081 ConfigurableAxis axisVertex{" axisVertex" , {10 , -10 , 10 }, " vertex axis for histograms" };
11182 ConfigurableAxis axisEta{" axisEta" , {40 , -1 ., 1 .}, " eta axis for histograms" };
11283 ConfigurableAxis axisPhi{" axisPhi" , {72 , 0.0 , constants::math::TwoPI}, " phi axis for histograms" };
@@ -125,7 +96,7 @@ struct CorrSparse {
12596 ConfigurableAxis axisPtEfficiency{" axisPtEfficiency" , {VARIABLE_WIDTH, 0.5 , 0.6 , 0.7 , 0.8 , 0.9 , 1.0 , 1.25 , 1.5 , 1.75 , 2.0 , 2.25 , 2.5 , 2.75 , 3.0 , 3.25 , 3.5 , 3.75 , 4.0 , 4.5 , 5.0 , 6.0 , 7.0 , 8.0 }, " pt axis for efficiency histograms" };
12697
12798 // make the filters and cuts.
128- Filter collisionFilter = (nabs(aod::collision::posZ) < cfgZVtxCut) && (aod::corrsparse::multiplicity) > cfgMinMult && (aod::corrsparse::multiplicity) < cfgMaxMult && (aod:: evsel::sel8) == true ;
99+ Filter collisionFilter = (nabs(aod::collision::posZ) < cfgZVtxCut) && (aod::evsel::sel8) == true ;
129100 Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t ) true ));
130101
131102 // Define the outputs
@@ -134,7 +105,7 @@ struct CorrSparse {
134105
135106 HistogramRegistry registry{" registry" };
136107
137- using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSel, o2::aod::Multiplicity >>; // aod::CentFT0Cs
108+ using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSel>>; // aod::CentFT0Cs
138109 using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>>;
139110
140111 void init (InitContext&)
@@ -155,11 +126,12 @@ struct CorrSparse {
155126 registry.add (" Eta" , " Eta" , {HistType::kTH1D , {axisEta}});
156127 registry.add (" pT" , " pT" , {HistType::kTH1D , {axisPtTrigger}});
157128 registry.add (" Nch" , " N_{ch}" , {HistType::kTH1D , {axisMultiplicity}});
129+ registry.add (" Nch_used" , " N_{ch}" , {HistType::kTH1D , {axisMultiplicity}}); // histogram to see how many events are in the same and mixed event
158130 registry.add (" zVtx" , " zVtx" , {HistType::kTH1D , {axisVertex}});
159131
160- registry.add (" Trig_hist" , " " , {HistType::kTHnSparseF , {{axisMultiplicity , axisVertex, axisPtTrigger}}});
132+ registry.add (" Trig_hist" , " " , {HistType::kTHnSparseF , {{axisSample , axisVertex, axisPtTrigger}}});
161133
162- registry.add (" eventcount" , " bin" , {HistType::kTH1F , {{3 , 0 , 3 , " bin" }}}); // histogram to see how many events are in the same and mixed event
134+ registry.add (" eventcount" , " bin" , {HistType::kTH1F , {{4 , 0 , 4 , " bin" }}}); // histogram to see how many events are in the same and mixed event
163135
164136 std::vector<AxisSpec> corrAxis = {{axisSample, " Sample" },
165137 {axisVertex, " z-vtx (cm)" },
@@ -219,11 +191,21 @@ struct CorrSparse {
219191 template <typename TCollision, typename TTracks>
220192 void fillYield (TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms.
221193 {
194+
222195 registry.fill (HIST (" Nch" ), tracks.size ());
223196 registry.fill (HIST (" zVtx" ), collision.posZ ());
224197
225198 for (auto const & track1 : tracks) {
226- registry.fill (HIST (" Phi" ), track1.phi ());
199+
200+ if (processMFT) {
201+ if constexpr (std::is_same_v<aod::MFTTracks, TTracks>) {
202+ if (!isAcceptedMftTrack (track1)) {
203+ continue ;
204+ }
205+ }
206+ }
207+
208+ registry.fill (HIST (" Phi" ), RecoDecay::constrainAngle (track1.phi (), 0.0 ));
227209 registry.fill (HIST (" Eta" ), track1.eta ());
228210 registry.fill (HIST (" pT" ), track1.pt ());
229211 }
@@ -255,7 +237,7 @@ struct CorrSparse {
255237
256238 //
257239 template <CorrelationContainer::CFStep step, typename TTracks, typename TTracksAssoc>
258- void fillCorrelations (TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, float Nch, int magneticField) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
240+ void fillCorrelations (TTracks tracks1, TTracksAssoc tracks2, float posZ, int system, int magneticField) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
259241 {
260242
261243 int fSampleIndex = gRandom ->Uniform (0 , cfgSampleSize);
@@ -264,7 +246,8 @@ struct CorrSparse {
264246 for (auto const & track1 : tracks1) {
265247
266248 if (system == SameEvent) {
267- registry.fill (HIST (" Trig_hist" ), Nch, posZ, track1.pt ());
249+ registry.fill (HIST (" Nch_used" ), tracks1.size ());
250+ registry.fill (HIST (" Trig_hist" ), fSampleIndex , posZ, track1.pt ());
268251 }
269252
270253 for (auto const & track2 : tracks2) {
@@ -290,13 +273,13 @@ struct CorrSparse {
290273
291274 const double kLimit = 3.0 * cfgMergingCut;
292275
293- bool bIsBelow = kFALSE ;
276+ bool bIsBelow = false ;
294277
295278 if (std::abs (dPhiStarLow) < kLimit || std::abs (dPhiStarHigh) < kLimit || dPhiStarLow * dPhiStarHigh < 0 ) {
296279 for (double rad (cfgRadiusLow); rad < cfgRadiusHigh; rad += 0.01 ) {
297280 double dPhiStar = getDPhiStar (track1, track2, rad, magneticField);
298281 if (std::abs (dPhiStar) < kLimit ) {
299- bIsBelow = kTRUE ;
282+ bIsBelow = true ;
300283 break ;
301284 }
302285 }
@@ -325,58 +308,82 @@ struct CorrSparse {
325308 auto bc = collision.bc_as <aod::BCsWithTimestamps>();
326309
327310 registry.fill (HIST (" eventcount" ), SameEvent); // because its same event i put it in the 1 bin
328- fillYield (collision, tracks);
329311
330312 if (processMFT) {
313+ fillYield (collision, mfts);
314+
315+ if (tracks.size () < cfgMinMult || tracks.size () >= cfgMaxMult) {
316+ return ;
317+ }
331318
332- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, mfts, collision.posZ (), SameEvent, tracks. size (), getMagneticField (bc.timestamp ()));
319+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, mfts, collision.posZ (), SameEvent, getMagneticField (bc.timestamp ()));
333320
334321 } else {
322+ fillYield (collision, tracks);
323+
324+ if (tracks.size () < cfgMinMult || tracks.size () >= cfgMaxMult) {
325+ return ;
326+ }
335327
336- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, tracks, collision.posZ (), SameEvent, tracks. size (), getMagneticField (bc.timestamp ()));
328+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks, tracks, collision.posZ (), SameEvent, getMagneticField (bc.timestamp ()));
337329 }
338330 }
339331 PROCESS_SWITCH (CorrSparse, processSame, " Process same event" , true );
340332
341- // event mixing
342- SliceCache cache;
343- using MixedBinning = ColumnBinningPolicy<aod::collision::PosZ, aod::corrsparse::Multiplicity>;
344-
345333 // the process for filling the mixed events
346334 void processMixed (AodCollisions const & collisions, AodTracks const & tracks, aod::MFTTracks const & MFTtracks, aod::BCsWithTimestamps const &)
347335 {
348336
337+ auto getTracksSize = [&tracks, this ](AodCollisions::iterator const & collision) {
338+ auto associatedTracks = tracks.sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), this ->cache );
339+ auto mult = associatedTracks.size ();
340+ return mult;
341+ };
342+
343+ using MixedBinning = FlexibleBinningPolicy<std::tuple<decltype (getTracksSize)>, aod::collision::PosZ, decltype (getTracksSize)>;
344+
345+ MixedBinning binningOnVtxAndMult{{getTracksSize}, {vtxMix, multMix}, true };
346+
349347 if (processMFT) {
350- MixedBinning binningOnVtxAndMult{{vtxMix, multMix}, true }; // true is for 'ignore overflows' (true by default)
351- auto tracksTuple = std::make_tuple (tracks, MFTtracks);
352- SameKindPair<AodCollisions, AodTracks, MixedBinning> pairs{binningOnVtxAndMult, cfgMinMixEventNum, -1 , collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
353348
354- for (auto const & [collision1, tracks1, collision2, tracks2] : pairs) {
349+ auto tracksTuple = std::make_tuple (tracks, MFTtracks);
350+ Pair<AodCollisions, AodTracks, aod::MFTTracks, MixedBinning> pair{binningOnVtxAndMult, cfgMinMixEventNum, -1 , collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
351+ for (auto const & [collision1, tracks1, collision2, tracks2] : pair) {
355352 registry.fill (HIST (" eventcount" ), MixedEvent); // fill the mixed event in the 3 bin
356353 auto bc = collision1.bc_as <aod::BCsWithTimestamps>();
357354
358- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, tracks1.size (), getMagneticField (bc.timestamp ()));
355+ if ((tracks1.size () < cfgMinMult || tracks1.size () >= cfgMaxMult))
356+ continue ;
357+
358+ if ((tracks2.size () < cfgMinMult || tracks2.size () >= cfgMaxMult))
359+ continue ;
360+
361+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, getMagneticField (bc.timestamp ()));
359362 }
360363 } else {
361- MixedBinning binningOnVtxAndMult{{vtxMix, multMix}, true }; // true is for 'ignore overflows' (true by default)
362364 auto tracksTuple = std::make_tuple (tracks, tracks);
363- SameKindPair<AodCollisions, AodTracks, MixedBinning> pairs{binningOnVtxAndMult, cfgMinMixEventNum, -1 , collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
364-
365- for (auto const & [collision1, tracks1, collision2, tracks2] : pairs) {
365+ Pair<AodCollisions, AodTracks, AodTracks, MixedBinning> pair{binningOnVtxAndMult, cfgMinMixEventNum, -1 , collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
366+ for (auto const & [collision1, tracks1, collision2, tracks2] : pair) {
366367 registry.fill (HIST (" eventcount" ), MixedEvent); // fill the mixed event in the 3 bin
367368 auto bc = collision1.bc_as <aod::BCsWithTimestamps>();
368369
369- fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, tracks1.size (), getMagneticField (bc.timestamp ()));
370+ if ((tracks1.size () < cfgMinMult || tracks1.size () >= cfgMaxMult))
371+ continue ;
372+
373+ if ((tracks2.size () < cfgMinMult || tracks2.size () >= cfgMaxMult))
374+ continue ;
375+
376+ fillCorrelations<CorrelationContainer::kCFStepReconstructed >(tracks1, tracks2, collision1.posZ (), MixedEvent, getMagneticField (bc.timestamp ()));
370377 }
371378 }
372379 }
380+
373381 PROCESS_SWITCH (CorrSparse, processMixed, " Process mixed events" , true );
374382};
375383
376384WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
377385{
378386 return WorkflowSpec{
379- adaptAnalysisTask<CalcNch>(cfgc),
380387 adaptAnalysisTask<CorrSparse>(cfgc),
381388 };
382389}
0 commit comments