1717#define HomogeneousField // o2-linter: disable=name/macro (required by KFParticle)
1818#endif
1919
20+ #include " PWGHF/Core/CentralityEstimation.h"
2021#include " PWGJE/DataModel/EMCALClusters.h"
2122
2223#include " Common/Core/RecoDecay.h"
24+ #include " Common/DataModel/Centrality.h"
2325#include " Common/DataModel/EventSelection.h"
26+ #include " Common/DataModel/Multiplicity.h"
2427#include " Common/DataModel/PIDResponseTPC.h"
2528#include " Common/DataModel/TrackSelectionTables.h"
2629#include " EventFiltering/Zorro.h"
5861using namespace o2 ;
5962using namespace o2 ::framework;
6063using namespace o2 ::framework::expressions;
64+ using namespace o2 ::hf_centrality;
6165
6266struct HfTaskElectronWeakBoson {
6367
@@ -121,6 +125,12 @@ struct HfTaskElectronWeakBoson {
121125 Configurable<int > kfConstructMethod{" kfConstructMethod" , 2 , " KF Construct Method" };
122126 Configurable<int > chiSqNdfMax{" chiSqNdfMax" , 10 , " Chi2 Max for mass reco by KF particle" };
123127
128+ // Centrality estimator configuration
129+ Configurable<int > centralityEstimator{" centralityEstimator" , CentralityEstimator::FT0M, " Centrality estimator. See CentralityEstimator for valid values." };
130+ Configurable<bool > enableCentralityAnalysis{" enableCentralityAnalysis" , true , " Enable centrality-dependent analysis" };
131+ Configurable<float > centralityMin{" centralityMin" , -1 , " minimum cut on centrality selection" };
132+ Configurable<float > centralityMax{" centralityMax" , 101 , " maximum cut on centrality selection" };
133+
124134 // CCDB service object
125135 Service<o2::ccdb::BasicCCDBManager> ccdb;
126136
@@ -142,7 +152,7 @@ struct HfTaskElectronWeakBoson {
142152 : pt(ptr), eta(e), phi(ph), mass(m), ptchild0(ptzee0), ptchild1(ptzee1), charge(ch) {}
143153 };
144154 std::vector<HfZeeCandidate> reconstructedZ;
145-
155+ using CollisionsWithCent = soa::Join<aod::Collisions, aod::CentFT0As, aod::CentFT0Cs, aod::CentFT0Ms, aod::CentFV0As>;
146156 using SelectedClusters = o2::aod::EMCALClusters;
147157 // PbPb
148158 // using TrackEle = o2::soa::Join<o2::aod::Tracks, o2::aod::FullTracks, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TrackSelection, o2::aod::pidTPCFullEl>;
@@ -186,6 +196,10 @@ struct HfTaskElectronWeakBoson {
186196 if (cfgSkimmedProcessing) {
187197 zorroSummary.setObject (zorro.getZorroSummary ());
188198 }
199+ // check centrality
200+ if (centralityEstimator < CentralityEstimator::FT0A || centralityEstimator > CentralityEstimator::FV0A) {
201+ LOGF (fatal, " Invalid centrality estimator: %d" , static_cast <int >(centralityEstimator.value ));
202+ }
189203
190204 // add configurable for CCDB path
191205 zorro.setBaseCCDBPath (cfgCCDBPath.value );
@@ -217,11 +231,14 @@ struct HfTaskElectronWeakBoson {
217231 const AxisSpec axisPtHadron{50 , 0 , 50 , " p_{T,hadron} (GeV/c)" };
218232 const AxisSpec axisPtZ{150 , 0 , 150 , " p_{T,Z} (GeV/c)" };
219233 const AxisSpec axisSign{2 , -2 , 2 , " charge sign" };
234+ const AxisSpec axisCentrality{10 , 0 , 100 , " Centrality (%)" };
235+ const AxisSpec axisPtRatio{200 , 0 , 2.0 , " pt ratio for h and Z" };
220236
221237 // create registrygrams
222238 registry.add (" hZvtx" , " Z vertex" , kTH1D , {axisZvtx});
223239 registry.add (" hEventCounterInit" , " hEventCounterInit" , kTH1D , {axisCounter});
224240 registry.add (" hEventCounter" , " hEventCounter" , kTH1D , {axisCounter});
241+ registry.add (" hCentrality" , " Centrality distribution" , kTH1D , {axisCentrality});
225242 registry.add (" hITSchi2" , " ITS #chi^{2}" , kTH1F , {axisChi2});
226243 registry.add (" hTPCchi2" , " TPC #chi^{2}" , kTH1F , {axisChi2});
227244 registry.add (" hTPCnCls" , " TPC NCls" , kTH1F , {axisCluster});
@@ -243,15 +260,13 @@ struct HfTaskElectronWeakBoson {
243260 registry.add (" hEMCtime" , " EMC timing" , kTH1F , {axisEMCtime});
244261 registry.add (" hIsolationEnergy" , " Isolation Energy" , kTH2F , {{axisE}, {axisIsoEnergy}});
245262 registry.add (" hIsolationTrack" , " Isolation Track" , kTH2F , {{axisE}, {axisIsoTrack}});
246- registry.add (" hInvMassZeeLs" , " invariant mass for Z LS pair" , kTH2F , {{axisPt}, {axisInvMassZ}});
247- registry.add (" hInvMassZeeUls" , " invariant mass for Z ULS pair" , kTH2F , {{axisPt}, {axisInvMassZ}});
248- registry.add (" hKfInvMassZeeLs" , " invariant mass for Z LS pair KFp" , kTH2F , {{axisPt}, {axisInvMassZ}});
249- registry.add (" hKfInvMassZeeUls" , " invariant mass for Z ULS pair KFp" , kTH2F , {{axisPt}, {axisInvMassZ}});
263+ registry.add (" hInvMassZee" , " invariant mass for Z ULS pair" , HistType::kTHnSparseF , {axisSign, axisPt, axisInvMassZ});
264+ registry.add (" hKfInvMassZee" , " invariant mass for Z ULS pair KFp" , HistType::kTHnSparseF , {axisSign, axisPt, axisInvMassZ});
250265 registry.add (" hTHnElectrons" , " electron info" , HistType::kTHnSparseF , {axisPt, axisNsigma, axisM02, axisEop, axisIsoEnergy, axisIsoTrack, axisEta, axisDedx});
251266 registry.add (" hTHnTrMatch" , " Track EMC Match" , HistType::kTHnSparseF , {axisPt, axisdPhi, axisdEta});
252267
253268 // Z-hadron correlation histograms
254- registry.add (" hZHadronDphi" , " Z-hadron #Delta#phi correlation" , HistType::kTHnSparseF , {axisSign, axisPtZ, axisDPhiZh});
269+ registry.add (" hZHadronDphi" , " Z-hadron #Delta#phi correlation" , HistType::kTHnSparseF , {axisSign, axisPtZ, axisDPhiZh, axisPtRatio, axisPtHadron });
255270 registry.add (" hZptSpectrum" , " Z boson p_{T} spectrum" , kTH2F , {{axisSign}, {axisPtZ}});
256271
257272 // hisotgram for EMCal trigger
@@ -323,6 +338,9 @@ struct HfTaskElectronWeakBoson {
323338 // LOG(info) << "Invarimass cal by KF particle ";
324339 for (const auto & track : tracks) {
325340
341+ if (std::abs (track.pt () - kfpIsoEle.GetPt ()) < ptMatch) {
342+ continue ;
343+ }
326344 if (track.pt () < ptZeeMin) {
327345 continue ;
328346 }
@@ -344,6 +362,8 @@ struct HfTaskElectronWeakBoson {
344362 auto child2 = RecoDecayPtEtaPhi::pVector (kfpAssEle.GetPt () * correctionPtElectron, kfpAssEle.GetEta (), kfpAssEle.GetPhi ());
345363 double invMassEE = RecoDecay::m (std::array{child1, child2}, std::array{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron});
346364
365+ registry.fill (HIST (" hInvMassZee" ), track.sign () * charge, kfpIsoEle.GetPt (), invMassEE);
366+
347367 // reco by KFparticle
348368 const KFParticle* electronPairs[2 ] = {&kfpIsoEle, &kfpAssEle};
349369 KFParticle zeeKF;
@@ -362,17 +382,9 @@ struct HfTaskElectronWeakBoson {
362382 }
363383 float massZee, massZeeErr;
364384 zeeKF.GetMass (massZee, massZeeErr);
385+ registry.fill (HIST (" hKfInvMassZee" ), track.sign () * charge, kfpIsoEle.GetPt (), massZee);
365386 // LOG(info) << "Invarimass cal by KF particle mass = " << massZee;
366387 // LOG(info) << "Invarimass cal by RecoDecay = " << invMassEE;
367-
368- if (track.sign () * charge > 0 ) {
369- registry.fill (HIST (" hKfInvMassZeeLs" ), kfpIsoEle.GetPt (), massZee);
370- registry.fill (HIST (" hInvMassZeeLs" ), kfpIsoEle.GetPt (), invMassEE);
371- } else {
372- registry.fill (HIST (" hKfInvMassZeeUls" ), kfpIsoEle.GetPt (), massZee);
373- registry.fill (HIST (" hInvMassZeeUls" ), kfpIsoEle.GetPt (), invMassEE);
374- }
375-
376388 reconstructedZ.emplace_back (
377389 zeeKF.GetPt (),
378390 zeeKF.GetEta (),
@@ -384,7 +396,8 @@ struct HfTaskElectronWeakBoson {
384396 }
385397 }
386398
387- void process (soa::Filtered<aod::Collisions>::iterator const & collision,
399+ // void process(soa::Filtered<aod::Collisions>::iterator const& collision,
400+ void process (soa::Filtered<CollisionsWithCent>::iterator const & collision,
388401 aod::BCsWithTimestamps const &,
389402 SelectedClusters const & emcClusters,
390403 TrackEle const & tracks,
@@ -446,6 +459,16 @@ struct HfTaskElectronWeakBoson {
446459
447460 registry.fill (HIST (" hZvtx" ), collision.posZ ());
448461
462+ // Calculate centrality
463+ if (enableCentralityAnalysis) {
464+ float centrality = o2::hf_centrality::getCentralityColl (collision, centralityEstimator);
465+ // LOG(info) << centrality;
466+ if (centrality < centralityMin || centrality > centralityMax) {
467+ return ;
468+ }
469+ registry.fill (HIST (" hCentrality" ), centrality);
470+ }
471+
449472 for (const auto & track : tracks) {
450473
451474 if (std::abs (track.eta ()) > etaTrMax) {
@@ -562,8 +585,9 @@ struct HfTaskElectronWeakBoson {
562585 }
563586 // LOG(info) << "E/p" << eop;
564587 registry.fill (HIST (" hEopNsigTPC" ), match.track_as <TrackEle>().tpcNSigmaEl (), eop);
565- if (match.emcalcluster_as <SelectedClusters>().m02 () < m02Min || match.emcalcluster_as <SelectedClusters>().m02 () > m02Max)
588+ if (match.emcalcluster_as <SelectedClusters>().m02 () < m02Min || match.emcalcluster_as <SelectedClusters>().m02 () > m02Max) {
566589 continue ;
590+ }
567591
568592 if (match.track_as <TrackEle>().tpcNSigmaEl () > nsigTpcMin && match.track_as <TrackEle>().tpcNSigmaEl () < nsigTpcMax) {
569593 registry.fill (HIST (" hEop" ), match.track_as <TrackEle>().pt (), eop);
@@ -624,7 +648,8 @@ struct HfTaskElectronWeakBoson {
624648 }
625649 // calculate Z-h correlation
626650 double deltaPhi = RecoDecay::constrainAngle (trackAss.phi - zBoson.phi , -o2::constants::math::PIHalf);
627- registry.fill (HIST (" hZHadronDphi" ), zBoson.charge , zBoson.pt , deltaPhi);
651+ double ptRatio = trackAss.pt / zBoson.pt ;
652+ registry.fill (HIST (" hZHadronDphi" ), zBoson.charge , zBoson.pt , deltaPhi, ptRatio, trackAss.pt );
628653 }
629654 }
630655 } // end of Z-hadron correlation
0 commit comments