2424#include " Common/DataModel/EventSelection.h"
2525#include " Common/DataModel/TrackSelectionTables.h"
2626#include " Common/DataModel/Centrality.h"
27+ #include " Common/DataModel/Multiplicity.h"
2728#include " PWGCF/Core/CorrelationContainer.h"
2829#include " PWGCF/Core/PairCuts.h"
2930#include " Common/Core/RecoDecay.h"
@@ -32,138 +33,131 @@ using namespace o2;
3233using namespace o2 ::framework;
3334using namespace o2 ::framework::expressions;
3435
36+ #define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
37+
3538struct CorrSparse {
36- Configurable<float > cfgZVtxCut = {" cfgZVtxCut" , 10.0 , " Vertex z cut. Default 10 cm" };
37- Configurable<float > cfgPtCutMin = {" cfgPtCutMin" , 0.2 , " Minimum accepted track pT. Default 0.2 GeV" };
38- Configurable<float > cfgPtCutMax = {" cfgPtCutMax" , 5.0 , " Maximum accepted track pT. Default 5.0 GeV" };
39- Configurable<float > cfgEtaCut = {" cfgEtaCut" , 0.8 , " Eta cut. Default 0.8" };
40- ConfigurableAxis axisVertex{" axisVertex" , {7 , -7 , 7 }, " vertex axis for histograms" };
39+ O2_DEFINE_CONFIGURABLE (cfgZVtxCut, float , 10 .0f , " Accepted z-vertex range" )
40+ O2_DEFINE_CONFIGURABLE (cfgPtCutMin, float , 0 .2f , " minimum accepted track pT" )
41+ O2_DEFINE_CONFIGURABLE (cfgPtCutMax, float , 10 .0f , " maximum accepted track pT" )
42+ O2_DEFINE_CONFIGURABLE (cfgEtaCut, float , 0 .8f , " Eta cut" )
43+ O2_DEFINE_CONFIGURABLE (cfgMinMixEventNum, int , 5 , " Minimum number of events to mix" )
44+
45+ ConfigurableAxis axisVertex{" axisVertex" , {20 , -10 , 10 }, " vertex axis for histograms" };
46+ ConfigurableAxis axisEta{" axisEta" , {40 , -1 ., 1 .}, " eta axis for histograms" };
47+ ConfigurableAxis axisPhi{" axisPhi" , {72 , 0.0 , constants::math::TwoPI}, " phi axis for histograms" };
48+ ConfigurableAxis axisPt{" axisPt" , {VARIABLE_WIDTH, 0.5 , 1.0 , 1.5 , 2.0 , 3.0 , 4.0 , 6.0 , 10.0 }, " pt axis for histograms" };
4149 ConfigurableAxis axisDeltaPhi{" axisDeltaPhi" , {72 , -PIHalf, PIHalf * 3 }, " delta phi axis for histograms" };
4250 ConfigurableAxis axisDeltaEta{" axisDeltaEta" , {40 , -2 , 2 }, " delta eta axis for histograms" };
4351 ConfigurableAxis axisPtTrigger{" axisPtTrigger" , {VARIABLE_WIDTH, 0.5 , 1.0 , 1.5 , 2.0 , 3.0 , 4.0 , 6.0 , 10.0 }, " pt trigger axis for histograms" };
4452 ConfigurableAxis axisPtAssoc{" axisPtAssoc" , {VARIABLE_WIDTH, 0.5 , 1.0 , 1.5 , 2.0 , 3.0 , 4.0 , 6.0 , 10.0 }, " pt associated axis for histograms" };
4553 ConfigurableAxis axisMultiplicity{" axisMultiplicity" , {VARIABLE_WIDTH, 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 50 , 60 , 80 , 100 }, " multiplicity / centrality axis for histograms" };
54+ ConfigurableAxis vtxMix{" vtxMix" , {VARIABLE_WIDTH, -10 , -9 , -8 , -7 , -6 , -5 , -4 , -3 , -2 , -1 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }, " vertex axis for mixed event histograms" };
55+ ConfigurableAxis multMix{" multMix" , {VARIABLE_WIDTH, 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 50 , 60 , 80 , 100 }, " multiplicity / centrality axis for mixed event histograms" };
56+
57+ // make the filters and cuts.
58+
59+ Filter collisionFilter = nabs(aod::collision::posZ) < cfgZVtxCut && (aod::evsel::sel8) == true ;
60+
61+ Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t ) true ));
62+
63+ // define the filtered collisions and tracks
64+
65+ using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSel, o2::aod::BarrelMults>>; // aod::CentFT0Cs
66+ using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra>>;
67+
4668 HistogramRegistry registry{" registry" };
47- int logcolls = 0 ;
48- int logcollpairs = 0 ;
4969
5070 void init (InitContext&)
5171 {
5272 LOGF (info, " Starting init" );
53- registry.add (" Yield" , " pT vs eta vs Nch" , {HistType::kTH3F , {{40 , 0 , 20 , " p_{T}" }, {100 , -2 , 2 , " #eta" }, {100 , 0 , 100 , " Nch" }}}); // check to see total number of tracks
54- registry.add (" etaphi_Trigger" , " eta vs phi vs Nch" , {HistType::kTH3F , {{100 , -2 , 2 , " #eta" }, {200 , 0 , TwoPI, " #varphi" }, {100 , 0 , 100 , " Nch" }}});
55-
5673 // Make histograms to check the distributions after cuts
5774 registry.add (" deltaEta_deltaPhi_same" , " " , {HistType::kTH2D , {axisDeltaPhi, axisDeltaEta}}); // check to see the delta eta and delta phi distribution
5875 registry.add (" deltaEta_deltaPhi_mixed" , " " , {HistType::kTH2D , {axisDeltaPhi, axisDeltaEta}});
59- registry.add (" Phi" , " Phi" , {HistType::kTH1D , {{ 72 , 0 , TwoPI, " Phi " } }});
60- registry.add (" Eta" , " Eta" , {HistType::kTH1D , {{ 40 , - 2 , 2 , " Eta " } }});
76+ registry.add (" Phi" , " Phi" , {HistType::kTH1D , {axisPhi }});
77+ registry.add (" Eta" , " Eta" , {HistType::kTH1D , {axisEta }});
6178 registry.add (" pT" , " pT" , {HistType::kTH1D , {axisPtTrigger}});
6279 registry.add (" Nch" , " N_{ch}" , {HistType::kTH1D , {axisMultiplicity}});
80+ registry.add (" zVtx" , " zVtx" , {HistType::kTH1D , {axisVertex}});
6381
64- registry.add (" Sparse_mixed" , " " , {HistType::kTHnSparseF , {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}}); // Make the output sparse
65- registry.add (" Sparse_same" , " " , {HistType::kTHnSparseF , {{axisVertex, axisPtTrigger, axisPtAssoc, axisMultiplicity, axisDeltaPhi, axisDeltaEta}}});
82+ registry.add (" Sparse_mixed" , " " , {HistType::kTHnSparseF , {{axisMultiplicity, axisVertex, axisPtTrigger, axisPtAssoc, axisDeltaPhi, axisDeltaEta}}}); // Make the output sparse
83+ registry.add (" Sparse_same" , " " , {HistType::kTHnSparseF , {{axisMultiplicity, axisVertex, axisPtTrigger, axisPtAssoc, axisDeltaPhi, axisDeltaEta}}});
84+ registry.add (" Trig_Hist" , " " , {HistType::kTH3F , {{axisMultiplicity, axisVertex, axisPtTrigger}}});
6685
67- const int maxMixBin = axisMultiplicity->size () * axisVertex->size ();
68- registry.add (" eventcount" , " bin" , {HistType::kTH1F , {{maxMixBin + 2 , -2.5 , -0.5 + maxMixBin, " bin" }}}); // histogram to see how many events are in the same and mixed event
86+ registry.add (" eventcount" , " bin" , {HistType::kTH1F , {{3 , 0 , 3 , " bin" }}}); // histogram to see how many events are in the same and mixed event
6987 }
88+ enum EventType {
89+ SameEvent = 1 ,
90+ MixedEvent = 3
91+ };
7092
7193 // fill multiple histograms
7294 template <typename TCollision, typename TTracks>
73- void fillYield (TCollision /* collision*/ , float /* centrality */ , TTracks tracks) // function to fill the yield and etaphi histograms.
95+ void fillYield (TCollision collision, TTracks tracks) // function to fill the yield and etaphi histograms.
7496 {
7597 registry.fill (HIST (" Nch" ), tracks.size ());
98+ registry.fill (HIST (" zVtx" ), collision.posZ ());
99+
76100 for (auto const & track1 : tracks) {
77- registry.fill (HIST (" Yield" ), track1.pt (), track1.eta (), track1.size ());
78- registry.fill (HIST (" etaphi_Trigger" ), track1.eta (), track1.phi (), track1.size ());
79101 registry.fill (HIST (" Phi" ), track1.phi ());
80102 registry.fill (HIST (" Eta" ), track1.eta ());
81103 registry.fill (HIST (" pT" ), track1.pt ());
82104 }
83105 }
84106
85- template <typename TCollision>
86- bool fillCollision (TCollision collision, float /* centrality*/ )
87- {
88-
89- if (!collision.sel8 ()) {
90- return false ;
91- }
92-
93- return true ;
94- }
95-
96107 template <typename TTracks>
97108 void fillCorrelations (TTracks tracks1, TTracks tracks2, float posZ, int system, float Nch) // function to fill the Output functions (sparse) and the delta eta and delta phi histograms
98109 {
99110 // loop over all tracks
100111 for (auto const & track1 : tracks1) {
101112
113+ if (system == SameEvent) {
114+ registry.fill (HIST (" Trig_Hist" ), Nch, posZ, track1.pt ());
115+ }
116+
102117 for (auto const & track2 : tracks2) {
103- if (track1 == track2) {
104- continue ;
105- }
118+
119+ if (track1. pt () <= track2. pt ())
120+ continue ; // skip if the trigger pt is less than the associate p
106121
107122 float deltaPhi = RecoDecay::constrainAngle (track1.phi () - track2.phi (), -PIHalf);
108123 float deltaEta = track1.eta () - track2.eta ();
109124
110125 // fill the right sparse and histograms
111- if (system == 1 ) {
126+ if (system == SameEvent ) {
112127 registry.fill (HIST (" deltaEta_deltaPhi_same" ), deltaPhi, deltaEta);
113- registry.fill (HIST (" Sparse_same" ), posZ, track1.pt (), track2.pt (), Nch , deltaPhi, deltaEta);
114- } else if (system == 2 ) {
128+ registry.fill (HIST (" Sparse_same" ), Nch, posZ, track1.pt (), track2.pt (), deltaPhi, deltaEta);
129+ } else if (system == MixedEvent ) {
115130 registry.fill (HIST (" deltaEta_deltaPhi_mixed" ), deltaPhi, deltaEta);
116- registry.fill (HIST (" Sparse_mixed" ), posZ, track1.pt (), track2.pt (), Nch , deltaPhi, deltaEta);
131+ registry.fill (HIST (" Sparse_mixed" ), Nch, posZ, track1.pt (), track2.pt (), deltaPhi, deltaEta);
117132 }
118133 }
119134 }
120135 }
121136
122- // make the filters and cuts.
123-
124- Filter collisionFilter = nabs(aod::collision::posZ) < cfgZVtxCut;
125-
126- Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t ) true ));
127-
128- // define the filtered collisions and tracks
129-
130- using AodCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>>;
131- using AodTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection, aod::TracksExtra, aod::TracksDCA>>;
132-
133137 void processSame (AodCollisions::iterator const & collision, AodTracks const & tracks)
134138 {
135- const auto centrality = collision.centFT0C ();
136139
137- registry.fill (HIST (" eventcount" ), - 2 ); // because its same event i put it in the -2 bin
138- fillYield (collision, centrality, tracks);
139- fillCorrelations (tracks, tracks, collision.posZ (), 1 , tracks.size ()); // fill the SE histogram and Sparse
140+ registry.fill (HIST (" eventcount" ), SameEvent ); // because its same event i put it in the 1 bin
141+ fillYield (collision, tracks);
142+ fillCorrelations (tracks, tracks, collision.posZ (), SameEvent , tracks.size ()); // fill the SE histogram and Sparse
140143 }
141144 PROCESS_SWITCH (CorrSparse, processSame, " Process same event" , true );
142145
143- // i do the event mixing (i have not changed this from the tutorial i got).
144- std::vector<double > vtxBinsEdges{VARIABLE_WIDTH, -7 .0f , -5 .0f , -3 .0f , -1 .0f , 1 .0f , 3 .0f , 5 .0f , 7 .0f };
145- std::vector<double > multBinsEdges{VARIABLE_WIDTH, 0 .0f , 5 .0f , 10 .0f , 20 .0f , 30 .0f , 40 .0f , 50.0 , 100 .1f };
146- SliceCache cache;
146+ // event mixing
147147
148- ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>
149- bindingOnVtxAndMult{{vtxBinsEdges, multBinsEdges}, true }; // true is for 'ignore overflows' (true by default)
150- SameKindPair<AodCollisions,
151- AodTracks,
152- ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>>
153- pair{bindingOnVtxAndMult, 5 , -1 , &cache}; // indicates that 5 events should be mixed and under/overflow (-1) to be ignored
148+ SliceCache cache;
149+ using MixedBinning = ColumnBinningPolicy<aod::collision::PosZ, aod::mult::MultTPC>;
154150
155151 // the process for filling the mixed events
156- void processMixed (AodCollisions const & /* collisions*/ , AodTracks const & /* tracks*/ )
152+ void processMixed (AodCollisions const & collisions, AodTracks const & tracks)
157153 {
158- for (auto const & [collision1, tracks1, collision2, tracks2] : pair) {
159-
160- if (fillCollision (collision1, collision1.centFT0C ()) == false ) {
161- continue ;
162- }
163-
164- registry.fill (HIST (" eventcount" ), 1 ); // fill the mixed event in the 1 bin
154+ MixedBinning binningOnVtxAndMult{{vtxMix, multMix}, true }; // true is for 'ignore overflows' (true by default)
155+ auto tracksTuple = std::make_tuple (tracks);
156+ SameKindPair<AodCollisions, AodTracks, MixedBinning> pairs{binningOnVtxAndMult, cfgMinMixEventNum, -1 , collisions, tracksTuple, &cache}; // -1 is the number of the bin to skip
165157
166- fillCorrelations (tracks1, tracks2, collision1.posZ (), 2 , tracks1.size ());
158+ for (auto const & [collision1, tracks1, collision2, tracks2] : pairs) {
159+ registry.fill (HIST (" eventcount" ), MixedEvent); // fill the mixed event in the 3 bin
160+ fillCorrelations (tracks1, tracks2, collision1.posZ (), MixedEvent, tracks1.size ());
167161 }
168162 }
169163 PROCESS_SWITCH (CorrSparse, processMixed, " Process mixed events" , true );
0 commit comments