diff --git a/PWGMM/Mult/Tasks/heavy-ion-mult.cxx b/PWGMM/Mult/Tasks/heavy-ion-mult.cxx index 7017d046a2c..dafcf0cd15b 100644 --- a/PWGMM/Mult/Tasks/heavy-ion-mult.cxx +++ b/PWGMM/Mult/Tasks/heavy-ion-mult.cxx @@ -49,18 +49,31 @@ using namespace o2::framework::expressions; using namespace o2::aod::track; using namespace o2::aod::evsel; -using CollisionDataTable = soa::Join; -using CollisionDataTableCorrelation = soa::Join; -using CollisionDataTableCentFT0C = soa::Join; +using CollisionDataTable = soa::Join; using TrackDataTable = soa::Join; using FilTrackDataTable = soa::Filtered; using CollisionMCTrueTable = aod::McCollisions; using TrackMCTrueTable = aod::McParticles; -using CollisionMCRecTable = soa::SmallGroups>; -using CollisionMCRecTableCentFT0C = soa::SmallGroups>; +using CollisionMCRecTable = soa::SmallGroups>; using TrackMCRecTable = soa::Join; using FilTrackMCRecTable = soa::Filtered; +enum { + kTrackTypebegin = 0, + kGlobalplusITS = 1, + kGlobalonly, + kITSonly, + kTrackTypeend +}; + +enum { + kGenpTbegin = 0, + kNoGenpTVar = 1, + kGenpTup, + kGenpTdown, + kGenpTend +}; + static constexpr TrackSelectionFlags::flagtype trackSelectionITS = TrackSelectionFlags::kITSNCls | TrackSelectionFlags::kITSChi2NDF | TrackSelectionFlags::kITSHits; @@ -73,14 +86,13 @@ static constexpr TrackSelectionFlags::flagtype trackSelectionDCA = static constexpr TrackSelectionFlags::flagtype trackSelectionDCAXYonly = TrackSelectionFlags::kDCAxy; -AxisSpec axisEvent{5, -0.5, 4.5, "#Event"}; -AxisSpec axisVtxZ{40, -20, 20, "Vertex Z"}; -AxisSpec axisDCA = {601, -3.01, 3.01}; -AxisSpec axisEta{40, -2, 2, "#eta"}; -AxisSpec axisPhi{629, 0, 2 * M_PI, "#phi"}; -AxisSpec axisPhi2{{0, M_PI / 2, M_PI, M_PI * 3. / 2, 2 * M_PI}, "#phi"}; -AxisSpec axisMCEvent_ambiguity{10, -0.5, 9.5, "reco collisions per true collision"}; +AxisSpec axisEvent{9, 0.5, 9.5, "#Event", "EventAxis"}; +AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"}; +AxisSpec axisEta{40, -2, 2, "#eta", "EtaAxis"}; +AxisSpec axisPhi{{0, M_PI / 4, M_PI / 2, M_PI * 3. / 4, M_PI, M_PI * 5. / 4, M_PI * 3. / 2, M_PI * 7. / 4, 2 * M_PI}, "#phi", "PhiAxis"}; AxisSpec axisCent{100, 0, 100, "#Cent"}; +AxisSpec AxisTrackType = {kTrackTypeend - 1, +kTrackTypebegin + 0.5, +kTrackTypeend - 0.5, "", "TrackTypeAxis"}; +AxisSpec AxisGenpTVary = {kGenpTend - 1, +kGenpTbegin + 0.5, +kGenpTend - 0.5, "", "GenpTVaryAxis"}; struct HeavyIonMultiplicity { @@ -93,22 +105,24 @@ struct HeavyIonMultiplicity { Configurable dcaZ{"dcaZ", 0.2f, "Custom DCA Z cut (ignored if negative)"}; ConfigurableAxis multHistBin{"MultDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis PVHistBin{"PVDistBinning", {501, -0.5, 500.5}, ""}; - ConfigurableAxis FV0multHistBin{"FV0MultDistBinning", {501, -0.5, 500.5}, ""}; - ConfigurableAxis FT0multHistBin{"FT0MultDistBinning", {501, -0.5, 500.5}, ""}; + ConfigurableAxis FV0AmultHistBin{"FV0AMultDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis FT0AmultHistBin{"FT0AMultDistBinning", {501, -0.5, 500.5}, ""}; ConfigurableAxis FT0CmultHistBin{"FT0CMultDistBinning", {501, -0.5, 500.5}, ""}; - ConfigurableAxis pTHistBin{"pTHistBin", {VARIABLE_WIDTH, 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100}, ""}; + ConfigurableAxis pTHistBin{"pTHistBin", {200, 0., 20.}, ""}; ConfigurableAxis CentralityBinning{"CentralityBinning", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}, ""}; + Configurable IsApplyExtraCorrCut{"IsApplyExtraCorrCut", false, "Enable extra NPVtracks vs FTOC correlation cut"}; + Configurable NPVtracksCut{"NPVtracksCut", 1.0f, "Apply extra NPVtracks cut"}; + Configurable FT0CCut{"FT0CCut", 1.0f, "Apply extra FT0C cut"}; + void init(InitContext const&) { AxisSpec axisMult = {multHistBin}; AxisSpec axisPV = {PVHistBin}; - AxisSpec axisFV0Mult = {FV0multHistBin}; - AxisSpec axisFT0Mult = {FT0multHistBin}; + AxisSpec axisFV0AMult = {FV0AmultHistBin}; AxisSpec axisFT0AMult = {FT0AmultHistBin}; AxisSpec axisFT0CMult = {FT0CmultHistBin}; - AxisSpec CentAxis = {CentralityBinning, "Centrality"}; + AxisSpec CentAxis = {CentralityBinning, "Centrality", "CentralityAxis"}; AxisSpec axisPT = {pTHistBin}; histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false); @@ -118,80 +132,92 @@ struct HeavyIonMultiplicity { auto* x = hstat->GetXaxis(); x->SetBinLabel(1, "All events"); x->SetBinLabel(2, "sel8"); - x->SetBinLabel(3, "kNoITSROFrameBorder"); - x->SetBinLabel(4, "kNoTimeFrameBorder"); - x->SetBinLabel(5, "|VtxZ|<10"); + x->SetBinLabel(3, "kNoSameBunchPileup"); // reject collisions in case of pileup with another collision in the same foundBC + x->SetBinLabel(4, "kIsGoodZvtxFT0vsPV"); // small difference between z-vertex from PV and from FT0 + x->SetBinLabel(5, "kIsVertexITSTPC"); // at least one ITS-TPC track (reject vertices built from ITS-only tracks) + x->SetBinLabel(6, "kIsVertexTOFmatched"); // at least one of vertex contributors is matched to TOF + x->SetBinLabel(7, "kIsVertexTRDmatched"); // at least one of vertex contributors is matched to TRD + x->SetBinLabel(8, "Centrality"); + x->SetBinLabel(9, "ApplyExtraCorrCut"); if (doprocessData) { - histos.add("MultHist", "MultHist", kTH1D, {axisMult}, true); - histos.add("EtaHist", "EtaHist", kTH1D, {axisEta}, true); - histos.add("PhiHist", "PhiHist", kTH1D, {axisPhi}, true); - histos.add("EtaVsVtxZHist", "EtaVsVtxZHist", kTH2D, {axisEta, axisVtxZ}, false); - histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2D, {axisPhi, axisEta}, false); - histos.add("DCAXYHist", "DCAXYHist", kTH1D, {axisDCA}, false); - histos.add("DCAZHist", "DCAZHist", kTH1D, {axisDCA}, false); - histos.add("pTHist", "pTHist", kTH1D, {axisPT}, true); - } - - if (doprocessMC) { - histos.add("MCEventHist_ambiguity", "MCEventHist_ambiguity", kTH1D, {axisMCEvent_ambiguity}, false); - histos.add("MCRecEtaHist", "MCRecEtaHist", kTH1D, {axisEta}, true); - histos.add("MCRecPhiHist", "MCRecPhiHist", kTH1D, {axisPhi}, true); - histos.add("MCRecPhiVsEtaHist", "MCRecPhiVsEtaHist", kTH2D, {axisPhi, axisEta}, false); - histos.add("EtaVsVtxZMCRecHist", "EtaVsVtxZMCRecHist", kTH2D, {axisEta, axisVtxZ}, true); - histos.add("DCAXYMCRecHist", "DCAXYMCRecHist", kTH1D, {axisDCA}, false); - histos.add("DCAZMCRecHist", "DCAZMCRecHist", kTH1D, {axisDCA}, false); - histos.add("pTMCRecHist", "pTMCRecHist", kTH1D, {axisPT}, true); - histos.add("MCRecMultHist", "MCRecMultHist", kTH1D, {axisMult}, true); - - histos.add("MCGenEtaHist", "MCGenEtaHist", kTH1D, {axisEta}, true); - histos.add("MCGenPhiHist", "MCGenPhiHist", kTH1D, {axisPhi}, true); - histos.add("MCGenPhiVsEtaHist", "MCGenPhiVsEtaHist", kTH2D, {axisPhi, axisEta}, false); - histos.add("EtaVsVtxZMCGenHist", "EtaVsVtxZMCGenHist", kTH2D, {axisEta, axisVtxZ}, true); - histos.add("MCGenMultHist", "MCGenMultHist", kTH1D, {axisMult}, true); - histos.add("MCGenVsRecMultHist", "MCGenVsRecMultHist", kTH2D, {axisMult, axisMult}, true); - histos.add("pTMCGenHist", "pTMCGenHist", kTH1D, {axisPT}, true); - histos.add("VtxZGenHist", "VtxZGenHist", kTH1D, {axisVtxZ}, false); - - histos.add("MCGenEtaHistAll", "MCGenEtaHistAll", kTH1D, {axisEta}, true); - histos.add("MCGenPhiHistAll", "MCGenPhiHistAll", kTH1D, {axisPhi}, true); - histos.add("MCGenPhiVsEtaHistAll", "MCGenPhiVsEtaHistAll", kTH2D, {axisPhi, axisEta}, false); - histos.add("EtaVsVtxZMCGenHistAll", "EtaVsVtxZMCGenHistAll", kTH2D, {axisEta, axisVtxZ}, true); - histos.add("MCGenMultHistAll", "MCGenMultHistAll", kTH1D, {axisMult}, true); - } - - if (doprocessDataCentFT0C) { histos.add("CentPercentileHist", "CentPercentileHist", kTH1D, {axisCent}, false); histos.add("CentHistInsideTrackloop", "CentHistInsideTrackloop", kTH1D, {axisCent}, false); - histos.add("hdatamult", "hdatamult", kTHnSparseF, {axisVtxZ, axisMult, CentAxis}, false); - histos.add("hdatadndeta", "hdatadndeta", kTHnSparseF, {axisVtxZ, CentAxis, axisEta, axisPhi2}, false); + histos.add("hdatamult", "hdatamult", kTHnSparseD, {axisVtxZ, axisMult, CentAxis}, false); + histos.add("hdatadndeta", "hdatadndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi, AxisTrackType}, false); histos.add("hdatazvtxcent", "hdatazvtxcent", kTH2D, {axisVtxZ, CentAxis}, false); } - if (doprocessMCCentFT0C) { + if (doprocessMonteCarlo) { histos.add("CentPercentileMCRecHist", "CentPercentileMCRecHist", kTH1D, {axisCent}, false); + histos.add("MCCentHistInsideTrackloop", "MCCentHistInsideTrackloop", kTH1D, {axisCent}, false); histos.add("hmczvtxcent", "hmczvtxcent", kTH2D, {axisVtxZ, CentAxis}, false); - histos.add("hrecdndeta_pion", "hrecdndeta_pion", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hrecdndeta_kaon", "hrecdndeta_kaon", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hrecdndeta_proton", "hrecdndeta_proton", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hrecdndeta_other", "hrecdndeta_other", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hrecdndeta_bkg", "hrecdndeta_bkg", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hrecdndeta_NotPrimary", "hrecdndeta_NotPrimary", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hgendndeta_pion", "hgendndeta_pion", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hgendndeta_kaon", "hgendndeta_kaon", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hgendndeta_proton", "hgendndeta_proton", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); - histos.add("hgendndeta_other", "hgendndeta_other", kTHnSparseF, {axisVtxZ, axisEta, axisPhi2, CentAxis, axisPT}, false); + histos.add("hmcrecdndeta", "hmcrecdndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi}, false); + histos.add("hmcgendndeta", "hmcgendndeta", kTHnSparseD, {axisVtxZ, CentAxis, axisEta, axisPhi, AxisGenpTVary}, false); + histos.add("hdndeta0_5", "hdndeta0_5", kTH1D, {axisEta}, false); + histos.add("hpTmcrecHist", "hpTmcrecHist", kTH1D, {axisPT}, false); + histos.add("hpTmcgenHist", "hpTmcgenHist", kTH1D, {axisPT}, false); + histos.add("hpTmcgenHist_up", "hpTmcgenHist_up", kTH1D, {axisPT}, false); + histos.add("hpTmcgenHist_down", "hpTmcgenHist_down", kTH1D, {axisPT}, false); } - if (doprocessCorrelation) { - histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisFT0AMult, axisMult}, true); - histos.add("GlobalMult_vs_FT0C", "GlobalMult_vs_FT0C", kTH2F, {axisFT0CMult, axisMult}, true); - histos.add("GlobalMult_vs_FT0", "GlobalMult_vs_FT0", kTH2F, {axisFT0Mult, axisMult}, true); - histos.add("GlobalMult_vs_FV0", "GlobalMult_vs_FV0", kTH2F, {axisFV0Mult, axisMult}, true); - histos.add("GlobalMult_vs_NumPVContributor", "GlobalMult_vs_NumPVContributor", kTH2F, {axisPV, axisMult}, true); + if (doprocessCorrelation || doprocessCorrelationMC) { + histos.add("GlobalMult_vs_FT0A", "GlobalMult_vs_FT0A", kTH2F, {axisMult, axisFT0AMult}, true); + histos.add("GlobalMult_vs_FT0C", "GlobalMult_vs_FT0C", kTH2F, {axisMult, axisFT0CMult}, true); + histos.add("NPVtracks_vs_FT0C", "NPVtracks_vs_FT0C", kTH2F, {axisPV, axisFT0CMult}, true); + histos.add("GlobalMult_vs_FV0A", "GlobalMult_vs_FV0A", kTH2F, {axisMult, axisFV0AMult}, true); + histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true); } } + template + bool IsEventSelected(CheckCol const& col) + { + histos.fill(HIST("EventHist"), 1); + + if (!col.sel8()) { + return false; + } + histos.fill(HIST("EventHist"), 2); + + if (!col.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) { + return false; + } + histos.fill(HIST("EventHist"), 3); + + if (!col.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV)) { + return false; + } + histos.fill(HIST("EventHist"), 4); + + if (!col.selection_bit(o2::aod::evsel::kIsVertexITSTPC)) { + return false; + } + histos.fill(HIST("EventHist"), 5); + + if (!col.selection_bit(o2::aod::evsel::kIsVertexTOFmatched)) { + return false; + } + histos.fill(HIST("EventHist"), 6); + + if (!col.selection_bit(o2::aod::evsel::kIsVertexTRDmatched)) { + return false; + } + histos.fill(HIST("EventHist"), 7); + + if (col.centFT0C() < 0. || col.centFT0C() > 100.) { + return false; + } + histos.fill(HIST("EventHist"), 8); + + if (IsApplyExtraCorrCut && col.multNTracksPV() > NPVtracksCut && col.multFT0C() < (10 * NPVtracksCut - FT0CCut)) { + return false; + } + histos.fill(HIST("EventHist"), 9); + + return true; + } + expressions::Filter trackSelectionProperMixed = ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::ITS) && ncheckbit(aod::track::trackCutFlag, trackSelectionITS) && ifnode(ncheckbit(aod::track::v001::detectorMap, (uint8_t)o2::aod::track::TPC), @@ -201,292 +227,146 @@ struct HeavyIonMultiplicity { void processData(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) { + + if (!IsEventSelected(collision)) { + return; + } + + histos.fill(HIST("VtxZHist"), collision.posZ()); + histos.fill(HIST("CentPercentileHist"), collision.centFT0C()); + histos.fill(HIST("hdatazvtxcent"), collision.posZ(), collision.centFT0C()); + auto NchTracks = 0; - histos.fill(HIST("EventHist"), 0); - if (collision.sel8()) { - histos.fill(HIST("EventHist"), 1); - if (collision.selection_bit(kNoITSROFrameBorder)) { - histos.fill(HIST("EventHist"), 2); - if (collision.selection_bit(kNoTimeFrameBorder)) { - histos.fill(HIST("EventHist"), 3); - if (std::abs(collision.posZ()) < VtxRange) { - histos.fill(HIST("EventHist"), 4); - histos.fill(HIST("VtxZHist"), collision.posZ()); - for (auto& track : tracks) { - if (std::abs(track.eta()) < etaRange) { - NchTracks++; - histos.fill(HIST("EtaHist"), track.eta()); - histos.fill(HIST("PhiHist"), track.phi()); - histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta()); - histos.fill(HIST("EtaVsVtxZHist"), track.eta(), collision.posZ()); - histos.fill(HIST("DCAXYHist"), track.dcaXY()); - histos.fill(HIST("DCAZHist"), track.dcaZ()); - histos.fill(HIST("pTHist"), track.pt()); - } - } - histos.fill(HIST("MultHist"), NchTracks); - } + for (auto& track : tracks) { + if (std::abs(track.eta()) < etaRange) { + NchTracks++; + histos.fill(HIST("CentHistInsideTrackloop"), collision.centFT0C()); + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), track.eta(), track.phi(), kGlobalplusITS); + + if (track.hasTPC()) { + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), track.eta(), track.phi(), kGlobalonly); + } else { + histos.fill(HIST("hdatadndeta"), collision.posZ(), collision.centFT0C(), track.eta(), track.phi(), kITSonly); } } } + histos.fill(HIST("hdatamult"), collision.posZ(), NchTracks, collision.centFT0C()); } - PROCESS_SWITCH(HeavyIonMultiplicity, processData, "process data", false); + PROCESS_SWITCH(HeavyIonMultiplicity, processData, "process data CentFT0C", false); - void processMC(CollisionMCTrueTable::iterator const& TrueCollision, CollisionMCRecTable const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) + void processCorrelation(CollisionDataTable::iterator const& collision, FilTrackDataTable const& tracks) { - histos.fill(HIST("MCEventHist_ambiguity"), RecCollisions.size()); - if (RecCollisions.size() == 0 || RecCollisions.size() > 1) { + + if (!IsEventSelected(collision)) { return; } - auto NchRecTracks = 0; - auto NchGenTracks = 0; - for (auto& RecCollision : RecCollisions) { - histos.fill(HIST("EventHist"), 0); - if (RecCollision.sel8()) { - histos.fill(HIST("EventHist"), 1); - if (RecCollision.selection_bit(kNoITSROFrameBorder)) { - histos.fill(HIST("EventHist"), 2); - if (RecCollision.selection_bit(kNoTimeFrameBorder)) { - histos.fill(HIST("EventHist"), 3); - if (std::abs(RecCollision.posZ()) < VtxRange) { - histos.fill(HIST("EventHist"), 4); - histos.fill(HIST("VtxZHist"), RecCollision.posZ()); - - auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); - for (auto& Rectrack : Rectrackspart) { - if (std::abs(Rectrack.eta()) < etaRange) { - NchRecTracks++; - histos.fill(HIST("MCRecEtaHist"), Rectrack.eta()); - histos.fill(HIST("MCRecPhiHist"), Rectrack.phi()); - histos.fill(HIST("MCRecPhiVsEtaHist"), Rectrack.phi(), Rectrack.eta()); - histos.fill(HIST("EtaVsVtxZMCRecHist"), Rectrack.eta(), RecCollision.posZ()); - histos.fill(HIST("DCAXYMCRecHist"), Rectrack.dcaXY()); - histos.fill(HIST("DCAZMCRecHist"), Rectrack.dcaZ()); - histos.fill(HIST("pTMCRecHist"), Rectrack.pt()); - } - } - - for (auto& particle : GenParticles) { - if (!particle.isPhysicalPrimary()) { - continue; - } - if (!particle.producedByGenerator()) { - continue; - } - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle == nullptr) { - continue; - } - if (std::abs(pdgParticle->Charge()) >= 3) { - if (std::abs(particle.eta()) < etaRange) { - NchGenTracks++; - histos.fill(HIST("MCGenEtaHist"), particle.eta()); - histos.fill(HIST("MCGenPhiHist"), particle.phi()); - histos.fill(HIST("MCGenPhiVsEtaHist"), particle.phi(), particle.eta()); - histos.fill(HIST("EtaVsVtxZMCGenHist"), particle.eta(), RecCollision.posZ()); - histos.fill(HIST("pTMCGenHist"), particle.pt()); - } - } - } - - histos.fill(HIST("MCRecMultHist"), NchRecTracks); - histos.fill(HIST("MCGenMultHist"), NchGenTracks); - histos.fill(HIST("MCGenVsRecMultHist"), NchRecTracks, NchGenTracks); - } - } - } + histos.fill(HIST("VtxZHist"), collision.posZ()); + auto NchTracks = 0; + for (auto& track : tracks) { + if (std::abs(track.eta()) < etaRange) { + NchTracks++; } } - auto NchGenTracksAll = 0; - for (auto& particle : GenParticles) { - if (!particle.isPhysicalPrimary()) { - continue; - } - if (!particle.producedByGenerator()) { - continue; - } - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle == nullptr) { - continue; - } - if (std::abs(pdgParticle->Charge()) >= 3) { - if (std::abs(TrueCollision.posZ()) < VtxRange) { - histos.fill(HIST("VtxZGenHist"), TrueCollision.posZ()); - if (std::abs(particle.eta()) < etaRange) { - NchGenTracksAll++; - histos.fill(HIST("MCGenEtaHistAll"), particle.eta()); - histos.fill(HIST("MCGenPhiHistAll"), particle.phi()); - histos.fill(HIST("MCGenPhiVsEtaHistAll"), particle.phi(), particle.eta()); - histos.fill(HIST("EtaVsVtxZMCGenHistAll"), particle.eta(), TrueCollision.posZ()); - } - } - } - } - histos.fill(HIST("MCGenMultHistAll"), NchGenTracksAll); + histos.fill(HIST("GlobalMult_vs_FT0A"), NchTracks, collision.multFT0A()); + histos.fill(HIST("GlobalMult_vs_FT0C"), NchTracks, collision.multFT0C()); + histos.fill(HIST("NPVtracks_vs_FT0C"), collision.multNTracksPV(), collision.multFT0C()); + histos.fill(HIST("GlobalMult_vs_FV0A"), NchTracks, collision.multFV0A()); + histos.fill(HIST("NPVtracks_vs_GlobalMult"), collision.multNTracksPV(), NchTracks); } - PROCESS_SWITCH(HeavyIonMultiplicity, processMC, "process MC", false); + PROCESS_SWITCH(HeavyIonMultiplicity, processCorrelation, "do correlation study in data", false); - void processDataCentFT0C(CollisionDataTableCentFT0C::iterator const& collision, FilTrackDataTable const& tracks) + void processMonteCarlo(CollisionMCTrueTable::iterator const&, CollisionMCRecTable const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) { - float cent = -1; - auto NchTracks = 0; - constexpr auto hasCentrality = CollisionDataTableCentFT0C::template contains(); - histos.fill(HIST("EventHist"), 0); - if (collision.sel8()) { - histos.fill(HIST("EventHist"), 1); - if (collision.selection_bit(kNoITSROFrameBorder)) { - histos.fill(HIST("EventHist"), 2); - if (collision.selection_bit(kNoTimeFrameBorder)) { - histos.fill(HIST("EventHist"), 3); - if constexpr (hasCentrality) { - cent = collision.centFT0C(); - if (cent < 0.0 || cent > 100.0) { - return; - } - histos.fill(HIST("EventHist"), 4); - histos.fill(HIST("VtxZHist"), collision.posZ()); - histos.fill(HIST("CentPercentileHist"), cent); - histos.fill(HIST("hdatazvtxcent"), collision.posZ(), cent); - for (auto& track : tracks) { - if (std::abs(track.eta()) < etaRange) { - NchTracks++; - histos.fill(HIST("CentHistInsideTrackloop"), cent); - histos.fill(HIST("hdatadndeta"), collision.posZ(), cent, track.eta(), track.phi()); - } - } - histos.fill(HIST("hdatamult"), collision.posZ(), NchTracks, cent); + + for (auto& RecCollision : RecCollisions) { + + if (!IsEventSelected(RecCollision)) { + continue; + } + + histos.fill(HIST("VtxZHist"), RecCollision.posZ()); + histos.fill(HIST("CentPercentileMCRecHist"), RecCollision.centFT0C()); + histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), RecCollision.centFT0C()); + + auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); + for (auto& Rectrack : Rectrackspart) { + if (std::abs(Rectrack.eta()) < etaRange) { + histos.fill(HIST("MCCentHistInsideTrackloop"), RecCollision.centFT0C()); + histos.fill(HIST("hmcrecdndeta"), RecCollision.posZ(), RecCollision.centFT0C(), Rectrack.eta(), Rectrack.phi()); + histos.fill(HIST("hpTmcrecHist"), Rectrack.pt()); + + if (RecCollision.centFT0C() >= 0 && RecCollision.centFT0C() < 5.0) { + histos.fill(HIST("hdndeta0_5"), Rectrack.eta()); } } - } - } - } + } // track (mcrec) loop - PROCESS_SWITCH(HeavyIonMultiplicity, processDataCentFT0C, "process data CentFT0C", false); + for (auto& particle : GenParticles) { - void processMCCentFT0C(CollisionMCTrueTable::iterator const& /*TrueCollision*/, CollisionMCRecTableCentFT0C const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks) - { - if (RecCollisions.size() == 0 || RecCollisions.size() > 1) { - return; - } + if (!particle.isPhysicalPrimary()) { + continue; + } - float cent = -1; - constexpr auto hasCentrality = CollisionMCRecTableCentFT0C::template contains(); + if (!particle.producedByGenerator()) { + continue; + } - for (auto& RecCollision : RecCollisions) { - histos.fill(HIST("EventHist"), 0); - if (RecCollision.sel8()) { - histos.fill(HIST("EventHist"), 1); - if (RecCollision.selection_bit(kNoITSROFrameBorder)) { - histos.fill(HIST("EventHist"), 2); - if (RecCollision.selection_bit(kNoTimeFrameBorder)) { - histos.fill(HIST("EventHist"), 3); - if constexpr (hasCentrality) { - cent = RecCollision.centFT0C(); - if (cent < 0.0 || cent > 100.0) { - continue; - } - histos.fill(HIST("EventHist"), 4); - histos.fill(HIST("VtxZHist"), RecCollision.posZ()); - histos.fill(HIST("CentPercentileMCRecHist"), cent); - histos.fill(HIST("hmczvtxcent"), RecCollision.posZ(), cent); - - auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex()); - for (auto& Rectrack : Rectrackspart) { - if (std::abs(Rectrack.eta()) > etaRange) { - continue; - } - if (Rectrack.has_mcParticle()) { - auto mcpart = Rectrack.mcParticle(); - if (std::abs(mcpart.eta()) > etaRange) { - continue; - } - if (mcpart.isPhysicalPrimary()) { - if (std::abs(mcpart.pdgCode()) == 211) { - histos.fill(HIST("hrecdndeta_pion"), RecCollision.posZ(), mcpart.eta(), mcpart.phi(), cent, mcpart.pt()); - } else if (std::abs(mcpart.pdgCode()) == 321) { - histos.fill(HIST("hrecdndeta_kaon"), RecCollision.posZ(), mcpart.eta(), mcpart.phi(), cent, mcpart.pt()); - } else if (std::abs(mcpart.pdgCode()) == 2212) { - histos.fill(HIST("hrecdndeta_proton"), RecCollision.posZ(), mcpart.eta(), mcpart.phi(), cent, mcpart.pt()); - } else { - histos.fill(HIST("hrecdndeta_other"), RecCollision.posZ(), mcpart.eta(), mcpart.phi(), cent, mcpart.pt()); - } - } else { - histos.fill(HIST("hrecdndeta_NotPrimary"), RecCollision.posZ(), mcpart.eta(), mcpart.phi(), cent, mcpart.pt()); - } - } else { - histos.fill(HIST("hrecdndeta_bkg"), RecCollision.posZ(), Rectrack.eta(), Rectrack.phi(), cent, Rectrack.pt()); - } - } - - for (auto& particle : GenParticles) { - if (!particle.isPhysicalPrimary()) { - continue; - } - if (!particle.producedByGenerator()) { - continue; - } - auto pdgParticle = pdg->GetParticle(particle.pdgCode()); - if (pdgParticle == nullptr) { - continue; - } - if (std::abs(pdgParticle->Charge()) >= 3) { - if (std::abs(particle.eta()) > etaRange) { - continue; - } - if (std::abs(particle.pdgCode()) == 211) { - histos.fill(HIST("hgendndeta_pion"), RecCollision.posZ(), particle.eta(), particle.phi(), cent, particle.pt()); - } else if (std::abs(particle.pdgCode()) == 321) { - histos.fill(HIST("hgendndeta_kaon"), RecCollision.posZ(), particle.eta(), particle.phi(), cent, particle.pt()); - } else if (std::abs(particle.pdgCode()) == 2212) { - histos.fill(HIST("hgendndeta_proton"), RecCollision.posZ(), particle.eta(), particle.phi(), cent, particle.pt()); - } else { - histos.fill(HIST("hgendndeta_other"), RecCollision.posZ(), particle.eta(), particle.phi(), cent, particle.pt()); - } - } - } + auto pdgParticle = pdg->GetParticle(particle.pdgCode()); + if (pdgParticle == nullptr) { + continue; + } + + if (std::abs(pdgParticle->Charge()) >= 3) { + if (std::abs(particle.eta()) < etaRange) { + histos.fill(HIST("hpTmcgenHist"), particle.pt()); + histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kNoGenpTVar); + + if (particle.pt() < 0.1) { + histos.fill(HIST("hpTmcgenHist_up"), particle.pt(), -10.0 * particle.pt() + 2); + histos.fill(HIST("hpTmcgenHist_down"), particle.pt(), 5.0 * particle.pt() + 0.5); + histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTup, -10.0 * particle.pt() + 2); + histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTdown, 5.0 * particle.pt() + 0.5); + } else { + histos.fill(HIST("hpTmcgenHist_up"), particle.pt()); + histos.fill(HIST("hpTmcgenHist_down"), particle.pt()); + histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTup); + histos.fill(HIST("hmcgendndeta"), RecCollision.posZ(), RecCollision.centFT0C(), particle.eta(), particle.phi(), kGenpTdown); } } } - } - } + } // track (mcgen) loop + } // collision loop } - PROCESS_SWITCH(HeavyIonMultiplicity, processMCCentFT0C, "process MC CentFT0C", false); + PROCESS_SWITCH(HeavyIonMultiplicity, processMonteCarlo, "process MC CentFT0C", false); - void processCorrelation(CollisionDataTableCorrelation::iterator const& collision, FilTrackDataTable const& tracks) + void processCorrelationMC(soa::Join::iterator const& collision, soa::Filtered> const& tracks) { + + if (!IsEventSelected(collision)) { + return; + } + + histos.fill(HIST("VtxZHist"), collision.posZ()); auto NchTracks = 0; - histos.fill(HIST("EventHist"), 0); - if (collision.sel8()) { - histos.fill(HIST("EventHist"), 1); - if (collision.selection_bit(kNoITSROFrameBorder)) { - histos.fill(HIST("EventHist"), 2); - if (collision.selection_bit(kNoTimeFrameBorder)) { - histos.fill(HIST("EventHist"), 3); - if (std::abs(collision.posZ()) < VtxRange) { - histos.fill(HIST("EventHist"), 4); - histos.fill(HIST("VtxZHist"), collision.posZ()); - for (auto& track : tracks) { - if (std::abs(track.eta()) < etaRange) { - NchTracks++; - } - } - histos.fill(HIST("GlobalMult_vs_FT0A"), collision.multFT0A(), NchTracks); - histos.fill(HIST("GlobalMult_vs_FT0C"), collision.multFT0C(), NchTracks); - histos.fill(HIST("GlobalMult_vs_FT0"), collision.multFT0A() + collision.multFT0C(), NchTracks); - histos.fill(HIST("GlobalMult_vs_FV0"), collision.multFV0A(), NchTracks); - histos.fill(HIST("GlobalMult_vs_NumPVContributor"), collision.numContrib(), NchTracks); - } - } + for (auto& track : tracks) { + if (std::abs(track.eta()) < etaRange) { + NchTracks++; } } + + histos.fill(HIST("GlobalMult_vs_FT0A"), NchTracks, collision.multFT0A()); + histos.fill(HIST("GlobalMult_vs_FT0C"), NchTracks, collision.multFT0C()); + histos.fill(HIST("NPVtracks_vs_FT0C"), collision.multNTracksPV(), collision.multFT0C()); + histos.fill(HIST("GlobalMult_vs_FV0A"), NchTracks, collision.multFV0A()); + histos.fill(HIST("NPVtracks_vs_GlobalMult"), collision.multNTracksPV(), NchTracks); } - PROCESS_SWITCH(HeavyIonMultiplicity, processCorrelation, "do correlation between FT0/FV0 Mult vs GlobalMult", false); + PROCESS_SWITCH(HeavyIonMultiplicity, processCorrelationMC, "do correlation study in MC", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)