2222#include " Common/DataModel/PIDResponse.h"
2323#include " Common/DataModel/TrackSelectionTables.h"
2424
25+ #include " CommonConstants/MathConstants.h"
2526#include " Framework/ASoAHelpers.h"
2627#include " Framework/AnalysisTask.h"
2728#include " Framework/HistogramRegistry.h"
@@ -46,6 +47,7 @@ using namespace o2;
4647using namespace o2 ::framework;
4748using namespace o2 ::framework::expressions;
4849using namespace o2 ::aod::mult;
50+ using namespace o2 ::constants::math;
4951using namespace o2 ::aod::evsel;
5052
5153#define O2_DEFINE_CONFIGURABLE (NAME, TYPE, DEFAULT, HELP ) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
@@ -54,37 +56,30 @@ struct FlowZdcTask {
5456 SliceCache cache;
5557
5658 O2_DEFINE_CONFIGURABLE (cfgCutVertex, float , 10 .0f , " Accepted z-vertex range" )
57- O2_DEFINE_CONFIGURABLE (cfgCutPtPOIMin, float , 0 .2f , " Minimal pT for poi tracks" )
58- O2_DEFINE_CONFIGURABLE (cfgCutPtPOIMax, float , 10 .0f , " Maximal pT for poi tracks" )
5959 O2_DEFINE_CONFIGURABLE (cfgCutPtMin, float , 0 .2f , " Minimal pT for ref tracks" )
6060 O2_DEFINE_CONFIGURABLE (cfgCutPtMax, float , 10 .0f , " Maximal pT for ref tracks" )
6161 O2_DEFINE_CONFIGURABLE (cfgCutEta, float , 0 .8f , " Eta range for tracks" )
6262 O2_DEFINE_CONFIGURABLE (cfgCutChi2prTPCcls, float , 2.5 , " Chi2 per TPC clusters" )
63- O2_DEFINE_CONFIGURABLE (cfgUseNch, bool , false , " Use Nch for flow observables" )
64- O2_DEFINE_CONFIGURABLE (cfgNbootstrap, int , 10 , " Number of subsamples" )
6563 O2_DEFINE_CONFIGURABLE (cfgCutDCAz, float , 2 , " DCA Z cut" )
6664 O2_DEFINE_CONFIGURABLE (cfgCutDCAxy, float , 0 .2f , " DCA XY cut" )
6765
68- Configurable<int > nBinsPt{" nBinsPt" , 500 , " N bins in pT histo" };
6966 Configurable<int > eventSelection{" eventSelection" , 1 , " event selection" };
7067 Configurable<float > maxZp{" maxZp" , 3099.5 , " Max ZP signal" };
71- Configurable<float > minTpcNcrossedRows{" minTpcNcrossedRows" , 20 , " minTpcNcrossedRows" };
7268 Configurable<float > maxZem{" maxZem" , 3099.5 , " Max ZEM signal" };
7369 // for ZDC info and analysis
7470 Configurable<int > nBinsAmp{" nBinsAmp" , 1025 , " nbinsAmp" };
75- Configurable<int > nBinsFT0Amp{" nBinsFT0Amp" , 250000 , " nbinsAmp" };
7671 Configurable<float > maxZn{" maxZn" , 4099.5 , " Max ZN signal" };
7772 Configurable<float > vtxRange{" vtxRange" , 10 .0f , " Vertex Z range to consider" };
7873 Configurable<float > etaRange{" etaRange" , 1 .0f , " Eta range to consider" };
79- Configurable<float > npvTracksCut{" npvTracksCut" , 1 .0f , " Apply extra NPVtracks cut" };
8074 // configs for process QA
8175 Configurable<int > nBinsNch{" nBinsNch" , 2501 , " N bins Nch (|eta|<0.8)" };
8276 Configurable<int > nBinsAmpFT0{" nBinsAmpFT0" , 100 , " N bins FT0 amp" };
8377 Configurable<float > maxAmpFT0{" maxAmpFT0" , 2500 , " Max FT0 amp" };
8478 Configurable<int > nBinsAmpFV0{" nBinsAmpFV0" , 100 , " N bins FV0 amp" };
8579 Configurable<float > maxAmpFV0{" maxAmpFV0" , 2000 , " Max FV0 amp" };
8680 Configurable<int > nBinsZDC{" nBinsZDC" , 400 , " nBinsZDC" };
87- Configurable<int > nBinsZEM{" nBinsZEM" , 100 , " nBinsZEM" };
81+ Configurable<int > nBinsZN{" nBinsZN" , 400 , " N bins ZN" };
82+ Configurable<int > nBinsZP{" nBinsZP" , 160 , " N bins ZP" };
8883 Configurable<float > minNch{" minNch" , 0 , " Min Nch (|eta|<0.8)" };
8984 Configurable<float > maxNch{" maxNch" , 2500 , " Max Nch (|eta|<0.8)" };
9085 Configurable<int > nBinsTDC{" nBinsTDC" , 150 , " nbinsTDC" };
@@ -104,6 +99,8 @@ struct FlowZdcTask {
10499 Configurable<bool > isZEMcut{" isZEMcut" , true , " Use ZEM cut?" };
105100 Configurable<bool > useMidRapNchSel{" useMidRapNchSel" , true , " Use mid-rapidit Nch selection" };
106101 Configurable<bool > applyEff{" applyEff" , true , " Apply track-by-track efficiency correction" };
102+ Configurable<bool > applyFD{" applyFD" , false , " Apply track-by-track feed down correction" };
103+ Configurable<bool > correctNch{" correctNch" , true , " Correct also Nch" };
107104
108105 Configurable<float > nSigmaNchCut{" nSigmaNchCut" , 1 ., " nSigma Nch selection" };
109106 Configurable<double > minNchSel{" minNchSel" , 5 ., " min Nch Selection" };
@@ -112,28 +109,21 @@ struct FlowZdcTask {
112109 Configurable<float > tdcCut{" tdcCut" , 1 ., " TDC cut" };
113110 Configurable<float > minOccCut{" minOccCut" , 0 , " min Occu cut" };
114111 Configurable<float > maxOccCut{" maxOccCut" , 500 , " max Occu cut" };
115- Configurable<int > minITSnCls{" minITSnCls" , 5 , " min ITSnCls" };
116112 Configurable<float > minPt{" minPt" , 0.1 , " minimum pt of the tracks" };
117113 Configurable<float > maxPt{" maxPt" , 3 ., " maximum pt of the tracks" };
118114 Configurable<float > maxPtSpectra{" maxPtSpectra" , 50 ., " maximum pt of the tracks" };
119- Configurable<float > minEta{" minEta" , -0.8 , " minimum eta" };
120- Configurable<float > maxEta{" maxEta" , +0.8 , " maximum eta" };
121115 // axis configs
122- ConfigurableAxis axisVertex{" axisVertex" , {20 , -10 , 10 }, " vertex axis for histograms" };
123116 ConfigurableAxis axisPhi{" axisPhi" , {60 , 0.0 , constants::math::TwoPI}, " phi axis for histograms" };
124- ConfigurableAxis axisEta{" axisEta" , {40 , -1 ., 1 .}, " eta axis for histograms" };
125- ConfigurableAxis axisPt{" axisPt" , {VARIABLE_WIDTH, 0.2 , 0.25 , 0.30 , 0.40 , 0.45 , 0.50 , 0.55 , 0.60 , 0.65 , 0.70 , 0.75 , 0.80 , 0.85 , 0.90 , 0.95 , 1.00 , 1.10 , 1.20 , 1.30 , 1.40 , 1.50 , 1.60 , 1.70 , 1.80 , 1.90 , 2.00 , 2.20 , 2.40 , 2.60 , 2.80 , 3.00 }, " pt axis for histograms" };
126117 ConfigurableAxis axisMultiplicity{" axisMultiplicity" , {3500 , 0 , 3500 }, " centrality axis for histograms" };
127- ConfigurableAxis axisEnergy{" axisEnergy" , {100 , 0 , 700 }, " energy axis for zdc histos" };
128- ConfigurableAxis axisMultTpc{" axisMultTpc" , {2000 , -0 .5f , 2999 .5f }, " TPCmultiplicity" };
129118 ConfigurableAxis axisZN{" axisZN" , {5000 , 0 , 500 }, " axisZN" };
130119 ConfigurableAxis axisZP{" axisZP" , {5000 , 0 , 500 }, " axisZP" };
131120 ConfigurableAxis axisFT0CAmp{" axisFT0CAmp" , {5000 , 0 , 5000 }, " axisFT0CAmp" };
132121 ConfigurableAxis axisFT0AAmp{" axisFT0AAmp" , {5000 , 0 , 5000 }, " axisFT0AAmp" };
133122 ConfigurableAxis axisFT0MAmp{" axisFT0MAmp" , {10000 , 0 , 10000 }, " axisFT0MAmp" };
134- ConfigurableAxis ft0cMultHistBin{" ft0cMultHistBin" , {501 , -0.5 , 500.5 }, " " };
135123 ConfigurableAxis multHistBin{" multHistBin" , {501 , -0.5 , 500.5 }, " " };
136124 ConfigurableAxis axisCent{" axisCent" , {10 , 0 , 100 }, " axisCent" };
125+ ConfigurableAxis ft0cMultHistBin{" ft0cMultHistBin" , {501 , -0.5 , 500.5 }, " " };
126+ ConfigurableAxis binsPt{" binsPt" , {VARIABLE_WIDTH, 0.0 , 0.1 , 0.12 }, " pT binning" };
137127 Configurable<float > posZcut{" posZcut" , +10.0 , " z-vertex position cut" };
138128 Configurable<float > minT0CcentCut{" minT0CcentCut" , 0.0 , " Min T0C Cent. cut" };
139129 Configurable<float > maxT0CcentCut{" maxT0CcentCut" , 90.0 , " Max T0C Cent. cut" };
@@ -155,6 +145,7 @@ struct FlowZdcTask {
155145 Configurable<std::string> paTH{" paTH" , " Users/s/sahernan/test" , " base path to the ccdb object" };
156146 Configurable<std::string> paTHmeanNch{" paTHmeanNch" , " Users/s/shernan/test" , " base path to the ccdb object" };
157147 Configurable<std::string> paTHsigmaNch{" paTHsigmaNch" , " Users/s/shernan/testSigma" , " base path to the ccdb object" };
148+ Configurable<std::string> paTHEff{" paTHEff" , " Users/s/shernan/TrackingEff" , " base path to the ccdb object" };
158149 Configurable<int64_t > ccdbNoLaterThan{" ccdbNoLaterThan" , std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count (), " latest acceptable timestamp of creation for the object" };
159150
160151 enum EvCutLabel {
@@ -191,6 +182,8 @@ struct FlowZdcTask {
191182 const AxisSpec axisCounter{1 , 0 , +1 , " " };
192183 const AxisSpec axisEvent{18 , 0.5 , 18.5 , " " };
193184 const AxisSpec axisZpos{48 , -12 ., 12 ., " Vtx_{z} (cm)" };
185+ const AxisSpec axisEta{40 , -1 ., +1 ., " #eta" };
186+ const AxisSpec axisPt{binsPt, " #it{p}_{T} (GeV/#it{c})" };
194187
195188 AxisSpec axisVtxZ{40 , -20 , 20 , " Vertex Z" , " VzAxis" };
196189 AxisSpec axisMult = {multHistBin, " Mult" , " MultAxis" };
@@ -201,9 +194,6 @@ struct FlowZdcTask {
201194 histos.add (" zPos" , " ;;Entries;" , kTH1F , {axisZpos});
202195
203196 histos.add (" eventCounter" , " eventCounter" , kTH1F , {axisCounter});
204- histos.add (" centHistogram" , " centHistogram" , kTH1F , {axisCent});
205- histos.add (" multHistogram" , " multHistogram" , kTH1F , {axisMultiplicity});
206- histos.add (" phiHistogram" , " phiHistogram" , kTH1F , {axisPhi});
207197 histos.add (" hZNvsFT0Ccent" ,
208198 " ZN Energy vs FT0C Centrality" ,
209199 kTH2F ,
@@ -215,8 +205,18 @@ struct FlowZdcTask {
215205 histos.add (" hNchvsNPV" , " ;NPVTracks (|#eta|<1);N_{ch} (|#eta|<0.8);" ,
216206 kTH2F ,
217207 {{{nBinsNch, -0.5 , maxNch}, {nBinsNch, -0.5 , maxNch}}});
218- histos.add (" hYield" , " Nch vs pT" , kTH2F , {axisMultiplicity, axisPt});
219- histos.add (" hGlobalTracks" , " hGlobalTracks" , kTH1F , {axisMultiplicity});
208+ histos.add (" T0Ccent" , " ;;Entries" , kTH1F , {axisCent});
209+ histos.add (" NchUncorrected" , " ;#it{N}_{ch} (|#eta| < 0.8);Entries;" , kTH1F , {{300 , 0 ., 3000 .}});
210+ histos.add (" ZNamp" , " ;ZNA+ZNC;Entries;" , kTH1F , {{nBinsZN, -0.5 , maxZn}});
211+ histos.add (" ExcludedEvtVsFT0M" , " ;T0A+T0C (#times 1/100, -3.3 < #eta < -2.1 and 3.5 < #eta < 4.9);Entries;" , kTH1F , {{nBinsAmpFT0, 0 ., maxAmpFT0}});
212+ histos.add (" ExcludedEvtVsNch" , " ;#it{N}_{ch} (|#eta|<0.8);Entries;" , kTH1F , {{300 , 0 , 3000 }});
213+ histos.add (" Nch" , " ;#it{N}_{ch} (|#eta| < 0.8, Corrected);" , kTH1F , {{nBinsNch, minNch, maxNch}});
214+ histos.add (" NchVsOneParCorr" , " ;#it{N}_{ch} (|#eta| < 0.8, Corrected);#LT[#it{p}_{T}^{(1)}]#GT (GeV/#it{c})" , kTProfile , {{nBinsNch, minNch, maxNch}});
215+ histos.add (" EtaVsPhi" , " ;#eta;#varphi" , kTH2F , {{{axisEta}, {100 , -0.1 * PI, +2.1 * PI}}});
216+ histos.add (" ZposVsEta" , " " , kTProfile , {axisZpos});
217+ histos.add (" sigma1Pt" , " ;;#sigma(p_{T})/p_{T};" , kTProfile , {axisPt});
218+ histos.add (" dcaXYvspT" , " ;DCA_{xy} (cm);;" , kTH2F , {{{50 , -1 ., 1 .}, {axisPt}}});
219+
220220 // event selection steps
221221 histos.add (" eventSelectionSteps" , " eventSelectionSteps" , kTH1D , {axisEvent});
222222 auto hstat = histos.get <TH1>(HIST (" eventSelectionSteps" ));
@@ -251,38 +251,24 @@ struct FlowZdcTask {
251251 histos.add (" ZEM2coll" , " ZEM2coll; ZEM2 amplitude; Entries" , {HistType::kTH1F , {{nBinsAmp, -0.5 , maxZem}}});
252252 histos.add (" ZNvsZEMcoll" , " ZNvsZEMcoll; ZEM; ZNA+ZNC" , {HistType::kTH2F , {{{nBinsAmp, -0.5 , maxZem}, {nBinsAmp, -0.5 , 2 . * maxZn}}}});
253253 histos.add (" ZNAvsZNCcoll" , " ZNAvsZNCcoll; ZNC; ZNA" , {HistType::kTH2F , {{{nBinsAmp, -0.5 , maxZn}, {nBinsAmp, -0.5 , maxZn}}}});
254-
255- histos.add (" SPAngleZNA" , " Spectator Plane Angle ZNA;Angle (radians);Entries" , {HistType::kTH1F , {{100 , -o2::constants::math::PI, o2::constants::math::PI}}});
256- histos.add (" SPAngleZNC" , " Spectator Plane Angle ZNC;Angle (radians);Entries" , {HistType::kTH1F , {{100 , -o2::constants::math::PI, o2::constants::math::PI}}});
257-
258- histos.add (" RunningAverageCosPsiDiff" , " Running Average of cos(psi) Differences;Running Average;Entries" , {HistType::kTH1F , {{100 , -1 , 1 }}});
259-
260- histos.add (" CosPsiDifferences" , " Differences in cos(psi);cos(psiZNC) - cos(psiZNA);Entries" , {HistType::kTH1F , {{100 , -2 , 2 }}});
261- histos.add (" hSinDifferences" , " Differences in sin(psi);sin(psiZNC) - sin(psiZNA);Entries" , {HistType::kTH1F , {{100 , -2 , 2 }}});
262254 histos.add (" ZDC_energy_vs_ZEM" , " ZDCvsZEM; ZEM; ZNA+ZNC+ZPA+ZPC" , {HistType::kTH2F , {{{nBinsAmp, -0.5 , maxZem}, {nBinsAmp, -0.5 , 2 . * maxZn}}}});
263255 // common energies information for ZDC
264- histos.add (" ZNCenergy" , " ZN energy side c" , kTH1F , {axisEnergy});
265- histos.add (" ZNAenergy" , " ZN energy side a" , kTH1F , {axisEnergy});
266- histos.add (" ZPCenergy" , " ZP energy side c" , kTH1F , {axisEnergy});
267- histos.add (" ZPAenergy" , " ZP energy side a" , kTH1F , {axisEnergy});
268- histos.add (" ZNenergy" , " common zn (a + c sides) energy" , kTH1F , {axisEnergy});
269- histos.add (" ZPenergy" , " common zp energy (a + c sides)" , kTH1F , {axisEnergy});
270- histos.add (" hFT0CAmp" , " ;Amplitude;counts" , kTH1F , {axisFT0CAmp});
271- histos.add (" hFT0AAmp" , " ;Amplitude;counts" , kTH1F , {axisFT0AAmp});
272- histos.add (" hFT0MAmp" , " ;Amplitude;counts" , kTH1F , {axisFT0MAmp});
256+ histos.add (" ZNCenergy" , " common sum ZN energy side c" , kTH1F , {axisZN});
257+ histos.add (" ZNAenergy" , " common sum ZN energy side a" , kTH1F , {axisZN});
258+ histos.add (" ZPCenergy" , " common sum ZP energy side c" , kTH1F , {axisZP});
259+ histos.add (" ZPAenergy" , " common sum ZP energy side a" , kTH1F , {axisZP});
260+ histos.add (" ZNenergy" , " common sum zn (a + c sides) energy" , kTH1F , {axisZN});
261+ histos.add (" ZPenergy" , " common sum zp energy (a + c sides)" , kTH1F , {axisZP});
273262 histos.add (" hZNvsFT0CAmp" , " ZN Energy vs FT0C Amplitude" , kTH2F , {axisFT0CAmp, axisZN});
274263 histos.add (" hZPvsFT0CAmp" , " ZP Energy vs FT0C Amplitude" , kTH2F , {axisFT0CAmp, axisZP});
275264 histos.add (" hZNvsMult" , " ZN Energy vs Multiplicity" , kTH2F , {axisMultiplicity, axisZN});
276265 histos.add (" hZPvsMult" , " ZP Energy vs Multiplicity" , kTH2F , {axisMultiplicity, axisZP});
277266 }
278267
279268 if (doprocessQA) {
280- histos.add (" T0Ccent" , " ;;Entries" , kTH1F , {axisCent});
281-
282269 histos.add (" ZNVsFT0A" , " ;T0A (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0}, {nBinsZDC, -0.5 , maxZn}}});
283270 histos.add (" ZNVsFT0C" , " ;T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., maxAmpFT0}, {nBinsZDC, -0.5 , maxZn}}});
284271 histos.add (" ZNVsFT0M" , " ;T0A+T0C (#times 1/100);ZNA+ZNC;" , kTH2F , {{{nBinsAmpFT0, 0 ., 3000 .}, {nBinsZDC, -0.5 , maxZn}}});
285-
286272 histos.add (" ZN" , " ;ZNA+ZNC;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZn}});
287273 histos.add (" ZNA" , " ;ZNA;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZn}});
288274 histos.add (" ZPA" , " ;ZPA;Entries;" , kTH1F , {{nBinsZDC, -0.5 , maxZp}});
@@ -612,6 +598,9 @@ struct FlowZdcTask {
612598 return ;
613599 }
614600 const auto & foundBC = collision.foundBC_as <BCsRun3>();
601+ if (!foundBC.has_zdc ()) {
602+ return ;
603+ }
615604 int nTot = tracks.size ();
616605 double ft0aAmp = 0 ;
617606 double ft0cAmp = 0 ;
@@ -625,13 +614,8 @@ struct FlowZdcTask {
625614 }
626615 }
627616 const double normT0M{(ft0aAmp + ft0aAmp) / 100 .};
628- histos.fill (HIST (" hFT0AAmp" ), ft0aAmp);
629- histos.fill (HIST (" hFT0CAmp" ), ft0aAmp);
630617 histos.fill (HIST (" hFT0MAmp" ), normT0M);
631618
632- if (!foundBC.has_zdc ()) {
633- return ;
634- }
635619 const auto & zdcread = foundBC.zdc ();
636620 const auto cent = collision.centFT0C ();
637621
@@ -656,6 +640,8 @@ struct FlowZdcTask {
656640 znC /= cfgCollisionEnergy;
657641 zpA /= cfgCollisionEnergy;
658642 zpC /= cfgCollisionEnergy;
643+ float sumZNs{znA + znC};
644+ float sumZPs{zpA + zpC};
659645 // TDC cut
660646 if (isTDCcut) {
661647 if (std::sqrt (std::pow (tZDCdif, 2 .) + std::pow (tZDCsum, 2 .)) > tdcCut) {
@@ -676,12 +662,88 @@ struct FlowZdcTask {
676662 float commonSumZpa = (zdcread.energyCommonZPA ());
677663 float sumZN = (sumZNC) + (sumZNA);
678664 float sumZP = (sumZPC) + (sumZPA);
679- histos.fill (HIST (" zPos" ), collision.posZ ());
680- histos.fill (HIST (" T0Ccent" ), collision.centFT0C ());
681- histos.fill (HIST (" ZNAcoll" ), znA);
682- histos.fill (HIST (" ZNCcoll" ), znC);
683- histos.fill (HIST (" ZPAcoll" ), zpA);
684- histos.fill (HIST (" ZPCcoll" ), zpC);
665+
666+ int itsTracks = 0 , glbTracks = 0 ;
667+ for (const auto & track : tracks) {
668+ // Track Selection
669+ if (track.hasITS ()) {
670+ itsTracks++;
671+ }
672+ if (!track.isGlobalTrack ()) {
673+ continue ;
674+ }
675+ if ((track.pt () < minPt) || (track.pt () > maxPt)) {
676+ continue ;
677+ }
678+ histos.fill (HIST (" ZposVsEta" ), collision.posZ (), track.eta ());
679+ histos.fill (HIST (" EtaVsPhi" ), track.eta (), track.phi ());
680+ histos.fill (HIST (" dcaXYvspT" ), track.dcaXY (), track.pt ());
681+ glbTracks++;
682+ }
683+ bool skipEvent{false };
684+ if (useMidRapNchSel) {
685+ auto hMeanNch = ccdb->getForTimeStamp <TH1F>(paTHmeanNch.value , foundBC.timestamp ());
686+ auto hSigmaNch = ccdb->getForTimeStamp <TH1F>(paTHsigmaNch.value , foundBC.timestamp ());
687+ if (!hMeanNch) {
688+ LOGF (info, " hMeanNch NOT LOADED!" );
689+ return ;
690+ }
691+ if (!hSigmaNch) {
692+ LOGF (info, " hSigmaNch NOT LOADED!" );
693+ return ;
694+ }
695+ const int binT0M{hMeanNch->FindBin (normT0M)};
696+ const double meanNch{hMeanNch->GetBinContent (binT0M)};
697+ const double sigmaNch{hSigmaNch->GetBinContent (binT0M)};
698+ const double nSigmaSelection{nSigmaNchCut * sigmaNch};
699+ const double diffMeanNch{meanNch - glbTracks};
700+ if (!(std::abs (diffMeanNch) < nSigmaSelection)) {
701+ histos.fill (HIST (" ExcludedEvtVsFT0M" ), normT0M);
702+ histos.fill (HIST (" ExcludedEvtVsNch" ), glbTracks);
703+ } else {
704+ skipEvent = true ;
705+ }
706+ }
707+ // Skip event based on number of Nch sigmas
708+ if (!skipEvent) {
709+ return ;
710+ }
711+ std::vector<float > pTs;
712+ std::vector<float > vecFD;
713+ std::vector<float > vecOneOverEff;
714+ auto efficiency = ccdb->getForTimeStamp <TH1F>(paTHEff.value , foundBC.timestamp ());
715+ if (!efficiency) {
716+ return ;
717+ }
718+ // Calculates the Nch multiplicity
719+ for (const auto & track : tracks) {
720+ // Track Selection
721+ if (!track.isGlobalTrack ()) {
722+ continue ;
723+ }
724+ if ((track.pt () < minPt) || (track.pt () > maxPt)) {
725+ continue ;
726+ }
727+
728+ float pt{track.pt ()};
729+ float effValue{1.0 };
730+ if (applyEff) {
731+ effValue = efficiency->GetBinContent (efficiency->FindBin (pt));
732+ }
733+ if (effValue > 0 .) {
734+ vecOneOverEff.emplace_back (1 . / effValue);
735+ }
736+ }
737+
738+ double nchMult{0 .};
739+ nchMult = std::accumulate (vecOneOverEff.begin (), vecOneOverEff.end (), 0 );
740+ if (!applyEff)
741+ nchMult = static_cast <double >(glbTracks);
742+ if (applyEff && !correctNch)
743+ nchMult = static_cast <double >(glbTracks);
744+ if (nchMult < minNchSel) {
745+ return ;
746+ }
685747 histos.get <TH2>(HIST (" ZNvsZEMcoll" ))->Fill (zdcread.amplitudeZEM1 () + zdcread.amplitudeZEM2 (), zdcread.amplitudeZNA () + zdcread.amplitudeZNC ());
686748 histos.get <TH2>(HIST (" ZNAvsZNCcoll" ))->Fill (zdcread.amplitudeZNC (), zdcread.amplitudeZNA ());
687749 histos.get <TH1>(HIST (" ZEM1coll" ))->Fill (zdcread.amplitudeZEM1 ());
@@ -699,6 +761,15 @@ struct FlowZdcTask {
699761 histos.fill (HIST (" hZNvsMult" ), nTot, sumZN);
700762 histos.fill (HIST (" hZPvsMult" ), nTot, sumZP);
701763 histos.fill (HIST (" hNchvsNPV" ), collision.multNTracksPVeta1 (), nTot);
764+ histos.fill (HIST (" Nch" ), nchMult);
765+ histos.fill (HIST (" ZNamp" ), sumZNs);
766+ histos.fill (HIST (" NchVsZN" ), nchMult, sumZNs);
767+ histos.fill (HIST (" NchVsZP" ), nchMult, sumZPs);
768+ histos.fill (HIST (" NITSTacksVsZN" ), itsTracks, sumZNs);
769+ histos.fill (HIST (" NITSTacksVsZP" ), itsTracks, sumZPs);
770+ histos.fill (HIST (" T0MVsZN" ), normT0M, sumZNs);
771+ histos.fill (HIST (" T0MVsZP" ), normT0M, sumZPs);
772+ histos.fill (HIST (" NchUncorrected" ), glbTracks);
702773
703774 float ratioZN = sumZNC / sumZNA;
704775 float ratioZP = sumZPC / sumZPA;
0 commit comments