diff --git a/PWGCF/Flow/Tasks/flowEventPlane.cxx b/PWGCF/Flow/Tasks/flowEventPlane.cxx index 6630c8d3b59..4606f5a99dd 100644 --- a/PWGCF/Flow/Tasks/flowEventPlane.cxx +++ b/PWGCF/Flow/Tasks/flowEventPlane.cxx @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -430,9 +431,15 @@ struct SpectatorPlaneTableProducer { Configurable cTpcRejCut{"cTpcRejCut", 3, "TPC Rej Cut"}; Configurable cTofNSigmaCut{"cTofNSigmaCut", 2, "TOF NSigma Cut"}; Configurable cTofRejCut{"cTofRejCut", 3, "TOF Rej Cut"}; - Configurable cPionPtCut{"cPionPtCut", 0.6, "Pion TPC pT cutoff"}; - Configurable cKaonPtCut{"cKaonPtCut", 0.6, "Kaon TPC pT cutoff"}; - Configurable cProtonPtCut{"cProtonPtCut", 1.1, "Proton TPC pT cutoff"}; + Configurable cPionPtpcMin{"cPionPtpcMin", 0.1, "Pion Minimum momentum"}; + Configurable cPionPtpcMax{"cPionPtpcMax", 0.6, "Pion pTPC cutoff"}; + Configurable cPionPtofMax{"cPionPtofMax", 2.5, "Pion Maximum momentum"}; + Configurable cKaonPtpcMin{"cKaonPtpcMin", 0.25, "Kaon Minimum momentum"}; + Configurable cKaonPtpcMax{"cKaonPtpcMax", 0.6, "Kaon pTPC cutoff"}; + Configurable cKaonPtofMax{"cKaonPtofMax", 2.5, "Kaon Maximum momentum"}; + Configurable cProtonPtpcMin{"cProtonPtpcMin", 0.6, "Proton Minimum momentum"}; + Configurable cProtonPtpcMax{"cProtonPtpcMax", 1.0, "Proton pTPC cutoff"}; + Configurable cProtonPtofMax{"cProtonPtofMax", 5.0, "Proton Maximum momentum"}; // Initialize CCDB Service Service ccdbService{}; @@ -936,15 +943,16 @@ struct SpectatorPlaneTableProducer { } template - bool checkTrackPid(float const& ptCut, float const& trackPt, std::vector const& vTpcNsig, std::vector const& vTofNsig, bool const& tofFlag) + bool checkTrackPid(float const& PtpcMinCut, float const& PtpcMaxCut, float const& PtofMaxCut, float const& Ptpc, float const& Ptof, std::vector const& vTpcNsig, std::vector const& vTofNsig, bool const& tofFlag) { + bool retFlag = false; - if (tofFlag) { + if (tofFlag && Ptpc > PtpcMinCut && Ptof < PtofMaxCut) { if (vTofNsig[part1] < cTofNSigmaCut && vTofNsig[part2] > cTofRejCut && vTofNsig[part3] > cTofRejCut && vTpcNsig[part1] < cTpcNSigmaCut) { retFlag = true; } } else { - if (trackPt < ptCut && vTpcNsig[part1] < cTpcNSigmaCut && vTpcNsig[part2] > cTpcRejCut && vTpcNsig[part3] > cTpcRejCut) { + if (Ptpc > PtpcMinCut && Ptpc < PtpcMaxCut && vTpcNsig[part1] < cTpcNSigmaCut && vTpcNsig[part2] > cTpcRejCut && vTpcNsig[part3] > cTpcRejCut) { retFlag = true; } } @@ -960,20 +968,22 @@ struct SpectatorPlaneTableProducer { } // Pion, Kaon, Proton Identification - std::vector vPtCut = {cPionPtCut, cKaonPtCut, cProtonPtCut}; + std::vector vPtpcMinCut = {cPionPtpcMin, cKaonPtpcMin, cProtonPtpcMin}; + std::vector vPtpcMaxCut = {cPionPtpcMax, cKaonPtpcMax, cProtonPtpcMax}; + std::vector vPtofMaxCut = {cPionPtofMax, cKaonPtofMax, cProtonPtofMax}; std::vector vTpcNsig = {std::abs(track.tpcNSigmaPi()), std::abs(track.tpcNSigmaKa()), std::abs(track.tpcNSigmaPr())}; std::vector vTofNsig = {std::abs(track.tofNSigmaPi()), std::abs(track.tofNSigmaKa()), std::abs(track.tofNSigmaPr())}; if (partType == kPi) { - return checkTrackPid(vPtCut[kPi], track.pt(), vTpcNsig, vTofNsig, track.hasTOF()); + return checkTrackPid(vPtpcMinCut[kPi], vPtpcMaxCut[kPi], vPtofMaxCut[kPi], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF()); } if (partType == kKa) { - return checkTrackPid(vPtCut[kKa], track.pt(), vTpcNsig, vTofNsig, track.hasTOF()); + return checkTrackPid(vPtpcMinCut[kKa], vPtpcMaxCut[kKa], vPtofMaxCut[kKa], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF()); } if (partType == kPr) { - return checkTrackPid(vPtCut[kPr], track.pt(), vTpcNsig, vTofNsig, track.hasTOF()); + return checkTrackPid(vPtpcMinCut[kPr], vPtpcMaxCut[kPr], vPtofMaxCut[kPr], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF()); } return false; @@ -1083,6 +1093,12 @@ struct FlowEventPlane { Configurable cLambdaMinPt{"cLambdaMinPt", 0.6, "Lambda Min pT"}; Configurable cLambdaMaxPt{"cLambdaMaxPt", 6.0, "Lambda Max pT"}; + // Resolution correction [sqrt(|Qa.Qc|) from CCDB] + Configurable cDoResCorr{"cDoResCorr", true, "Divide u.Q by sqrt(|Qa.Qc|)"}; + Configurable cCcdbUrl{"cCcdbUrl", "http://ccdb-test.cern.ch:8080", "url of ccdb"}; + Configurable cCcdbPath{"cCcdbPath", "Users/y/ypatley/DFOO", "Path for ccdb-object"}; + Configurable nolaterthan{"nolaterthan", std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(), "latest acceptable timestamp of creation for the object"}; + ConfigurableAxis axisVarCent{"axisVarCent", {VARIABLE_WIDTH, 0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 100}, "Variable width centrality bins"}; // Histogram registry: an object to hold your histograms @@ -1092,8 +1108,20 @@ struct FlowEventPlane { float cent = 0.; std::array vSP = {0., 0., 0., 0.}; + // CCDB service and resolution histogram + Service ccdbService{}; + TH1F* hSqrtQaQc = nullptr; + int cRunNum = 0, lRunNum = 0; + void init(InitContext const&) { + + // Set CCDB url + ccdbService->setURL(cCcdbUrl.value); + ccdbService->setCaching(true); + ccdbService->setLocalObjectValidityChecking(); + ccdbService->setCreatedNotAfter(nolaterthan.value); + // Define axes // const AxisSpec axisCent{100, 0., 100, "FT0C%"}; @@ -1101,6 +1129,8 @@ struct FlowEventPlane { const AxisSpec axisV1{400, -4, 4, "v_{1}"}; const AxisSpec axisTrackPt{100, 0., 10., "p_{T} (GeV/#it{c})"}; + const AxisSpec axisTrackpTOF(100, 0, 5, "p_{TOF} (GeV/#it{c})"); + const AxisSpec axisTrackpTPC(80, 0, 4, "p_{TPC} (GeV/#it{c})"); const AxisSpec axisTrackEtaCharged{cEtaBinsCharged, -0.8, 0.8, "#etaCharged"}; const AxisSpec axisTrackEtaHadrons{cEtaBinsHadrons, -0.8, 0.8, "#etaHadrons"}; const AxisSpec axisTrackEtaStrange{cEtaBinsStrange, -0.8, 0.8, "#etaStrange"}; @@ -1137,14 +1167,22 @@ struct FlowEventPlane { histos.add("DF/hCQuPos", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); histos.add("DF/hAQuNeg", "u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); histos.add("DF/hCQuNeg", "u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + + histos.add("DF/hResVsCent", "#sqrt{|#LTQ_{A}Q_{C}#GT|} used", kTProfile, {{100, 0., 100., "FT0C%"}}); + histos.add("DF/hV1A", "(u_{x}X^{A}_{1} + u_{y}Y^{A}_{1}) / #sqrt{|#LTQ_{A}Q_{C}#GT|}", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + histos.add("DF/hV1C", "(u_{x}X^{C}_{1} + u_{y}Y^{C}_{1}) / #sqrt{|#LTQ_{A}Q_{C}#GT|}", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + histos.add("DF/hV1APos", "v_{1}^{A} (+)", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + histos.add("DF/hV1CPos", "v_{1}^{C} (+)", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + histos.add("DF/hV1ANeg", "v_{1}^{A} (-)", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); + histos.add("DF/hV1CNeg", "v_{1}^{C} (-)", kTProfile2D, {axisVarCent, axisTrackEtaCharged}); } // Identified hadrons if (doprocessIdFlow) { - histos.add("PartId/Pion/hdEdX", "dE/dx vs pT", kTH2F, {axisMomPID, axisTrackdEdx}); - histos.add("PartId/Pion/hTOFSignal", "#beta_{TOF} vs p_{T}", kTH2F, {axisMomPID, axisTrackTofSignal}); - histos.add("PartId/Pion/hTPCNSigma", "n#sigma_{TPC} vs p_{T}", kTH2F, {axisMomPID, axisTrackNSigma}); - histos.add("PartId/Pion/hTOFNSigma", "n#sigma_{TOF} vs p_{T}", kTH2F, {axisMomPID, axisTrackNSigma}); + histos.add("PartId/Pion/hdEdX", "dE/dx vs pT", kTH2F, {axisTrackpTPC, axisTrackdEdx}); + histos.add("PartId/Pion/hTOFSignal", "#beta_{TOF} vs p_{T}", kTH2F, {axisTrackpTOF, axisTrackTofSignal}); + histos.add("PartId/Pion/hTPCNSigma", "n#sigma_{TPC} vs p_{T}", kTH2F, {axisTrackpTPC, axisTrackNSigma}); + histos.add("PartId/Pion/hTOFNSigma", "n#sigma_{TOF} vs p_{T}", kTH2F, {axisTrackpTOF, axisTrackNSigma}); histos.add("PartId/Pion/hAQuPos", "PartId/Pion/hAQuPos", kTProfile2D, {axisVarCent, axisTrackEtaHadrons}); histos.add("PartId/Pion/hAQuNeg", "PartId/Pion/hAQuNeg", kTProfile2D, {axisVarCent, axisTrackEtaHadrons}); histos.add("PartId/Pion/hCQuPos", "PartId/Pion/hCQuPos", kTProfile2D, {axisVarCent, axisTrackEtaHadrons}); @@ -1211,6 +1249,22 @@ struct FlowEventPlane { return true; } + // Load sqrt(|Qa.Qc|) vs centrality from CCDB + void loadResolution() + { + hSqrtQaQc = nullptr; + std::string ccdbPath = static_cast(cCcdbPath) + "/QaQc" + "/Run" + std::to_string(cRunNum); + auto ccdbObj = ccdbService->getForTimeStamp(ccdbPath, nolaterthan.value); + if (!ccdbObj) { + LOGF(warning, "QaQc CCDB OBJECT NOT FOUND: %s", ccdbPath.c_str()); + return; + } + hSqrtQaQc = dynamic_cast(ccdbObj->FindObject("hSqrtQaQc")); + if (!hSqrtQaQc) { + LOGF(warning, "hSqrtQaQc not found in %s", ccdbPath.c_str()); + } + } + template void getIdFlow(T const& tracks) { @@ -1230,11 +1284,11 @@ struct FlowEventPlane { } else { return; } - histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hdEdX"), track.pt(), track.tpcSignal()); - histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTPCNSigma"), track.pt(), tpcNsigma); + histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hdEdX"), track.tpcInnerParam(), track.tpcSignal()); + histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTPCNSigma"), track.tpcInnerParam(), tpcNsigma); if (track.hasTOF()) { - histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTOFSignal"), track.pt(), track.beta()); - histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTOFNSigma"), track.pt(), tofNsigma); + histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTOFSignal"), track.tofExpMom(), track.beta()); + histos.fill(HIST("PartId/") + HIST(SubDir[part]) + HIST("hTOFNSigma"), track.tofExpMom(), tofNsigma); } // Directed flow @@ -1390,12 +1444,35 @@ struct FlowEventPlane { PROCESS_SWITCH(FlowEventPlane, processDummy, "Dummy process", true); - void processChargedFlow(CollisionsRun3::iterator const& collision, Tracks const&) + void processChargedFlow(CollisionsRun3::iterator const& collision, aod::BCsWithTimestamps const&, Tracks const&) { + // Load resolution on run change + if (cDoResCorr) { + cRunNum = collision.template bc_as().runNumber(); + if (lRunNum != cRunNum) { + loadResolution(); + lRunNum = cRunNum; + } + } + // Check collision if (!selCollision(collision, vSP)) { return; } + + // Resolution for this event: sqrt(|Qa.Qc|) in its 1% centrality bin + float res = 1.; + if (cDoResCorr) { + if (!hSqrtQaQc) { + return; + } + res = hSqrtQaQc->GetBinContent(hSqrtQaQc->FindBin(cent)); + if (res <= 0.) { + return; + } + histos.fill(HIST("DF/hResVsCent"), cent, res); + } + // Loop over tracks auto chargedTracks = chargedTrackPartition->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache); float ux = 0., uy = 0., v1a = 0., v1c = 0.; @@ -1411,15 +1488,24 @@ struct FlowEventPlane { v1a = ux * vSP[kXa] + uy * vSP[kYa]; v1c = ux * vSP[kXc] + uy * vSP[kYc]; - // Charged particle directed flow + // Charged particle u.Q (unchanged) histos.fill(HIST("DF/hAQu"), cent, track.eta(), v1a); histos.fill(HIST("DF/hCQu"), cent, track.eta(), v1c); + + // Resolution corrected v1 + histos.fill(HIST("DF/hV1A"), cent, track.eta(), v1a / res); + histos.fill(HIST("DF/hV1C"), cent, track.eta(), v1c / res); + if (track.sign() > 0) { histos.fill(HIST("DF/hAQuPos"), cent, track.eta(), v1a); histos.fill(HIST("DF/hCQuPos"), cent, track.eta(), v1c); + histos.fill(HIST("DF/hV1APos"), cent, track.eta(), v1a / res); + histos.fill(HIST("DF/hV1CPos"), cent, track.eta(), v1c / res); } else { histos.fill(HIST("DF/hAQuNeg"), cent, track.eta(), v1a); histos.fill(HIST("DF/hCQuNeg"), cent, track.eta(), v1c); + histos.fill(HIST("DF/hV1ANeg"), cent, track.eta(), v1a / res); + histos.fill(HIST("DF/hV1CNeg"), cent, track.eta(), v1c / res); } } }