Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 105 additions & 20 deletions PWGCF/Flow/Tasks/flowEventPlane.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,15 @@ struct SpectatorPlaneTableProducer {
Configurable<float> cTpcRejCut{"cTpcRejCut", 3, "TPC Rej Cut"};
Configurable<float> cTofNSigmaCut{"cTofNSigmaCut", 2, "TOF NSigma Cut"};
Configurable<float> cTofRejCut{"cTofRejCut", 3, "TOF Rej Cut"};
Configurable<float> cPionPtCut{"cPionPtCut", 0.6, "Pion TPC pT cutoff"};
Configurable<float> cKaonPtCut{"cKaonPtCut", 0.6, "Kaon TPC pT cutoff"};
Configurable<float> cProtonPtCut{"cProtonPtCut", 1.1, "Proton TPC pT cutoff"};
Configurable<float> cPionPtpcMin{"cPionPtpcMin", 0.1, "Pion Minimum momentum"};
Configurable<float> cPionPtpcMax{"cPionPtpcMax", 0.6, "Pion pTPC cutoff"};
Configurable<float> cPionPtofMax{"cPionPtofMax", 2.5, "Pion Maximum momentum"};
Configurable<float> cKaonPtpcMin{"cKaonPtpcMin", 0.25, "Kaon Minimum momentum"};
Configurable<float> cKaonPtpcMax{"cKaonPtpcMax", 0.6, "Kaon pTPC cutoff"};
Configurable<float> cKaonPtofMax{"cKaonPtofMax", 2.5, "Kaon Maximum momentum"};
Configurable<float> cProtonPtpcMin{"cProtonPtpcMin", 0.6, "Proton Minimum momentum"};
Configurable<float> cProtonPtpcMax{"cProtonPtpcMax", 1.0, "Proton pTPC cutoff"};
Configurable<float> cProtonPtofMax{"cProtonPtofMax", 5.0, "Proton Maximum momentum"};

// Initialize CCDB Service
Service<o2::ccdb::BasicCCDBManager> ccdbService{};
Expand Down Expand Up @@ -936,15 +942,16 @@ struct SpectatorPlaneTableProducer {
}

template <ParticleType part1, ParticleType part2, ParticleType part3>
bool checkTrackPid(float const& ptCut, float const& trackPt, std::vector<float> const& vTpcNsig, std::vector<float> const& vTofNsig, bool const& tofFlag)
bool checkTrackPid(float const& PtpcMinCut, float const& PtpcMaxCut, float const& PtofMaxCut, float const& Ptpc, float const& Ptof, std::vector<float> const& vTpcNsig, std::vector<float> 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;
}
}
Expand All @@ -960,20 +967,22 @@ struct SpectatorPlaneTableProducer {
}

// Pion, Kaon, Proton Identification
std::vector<float> vPtCut = {cPionPtCut, cKaonPtCut, cProtonPtCut};
std::vector<float> vPtpcMinCut = {cPionPtpcMin, cKaonPtpcMin, cProtonPtpcMin};
std::vector<float> vPtpcMaxCut = {cPionPtpcMax, cKaonPtpcMax, cProtonPtpcMax};
std::vector<float> vPtofMaxCut = {cPionPtofMax, cKaonPtofMax, cProtonPtofMax};
std::vector<float> vTpcNsig = {std::abs(track.tpcNSigmaPi()), std::abs(track.tpcNSigmaKa()), std::abs(track.tpcNSigmaPr())};
std::vector<float> vTofNsig = {std::abs(track.tofNSigmaPi()), std::abs(track.tofNSigmaKa()), std::abs(track.tofNSigmaPr())};

if (partType == kPi) {
return checkTrackPid<kPi, kKa, kPr>(vPtCut[kPi], track.pt(), vTpcNsig, vTofNsig, track.hasTOF());
return checkTrackPid<kPi, kKa, kPr>(vPtpcMinCut[kPi], vPtpcMaxCut[kPi], vPtofMaxCut[kPi], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF());
}

if (partType == kKa) {
return checkTrackPid<kKa, kPi, kPr>(vPtCut[kKa], track.pt(), vTpcNsig, vTofNsig, track.hasTOF());
return checkTrackPid<kKa, kPi, kPr>(vPtpcMinCut[kKa], vPtpcMaxCut[kKa], vPtofMaxCut[kKa], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF());
}

if (partType == kPr) {
return checkTrackPid<kPr, kPi, kKa>(vPtCut[kPr], track.pt(), vTpcNsig, vTofNsig, track.hasTOF());
return checkTrackPid<kPr, kPi, kKa>(vPtpcMinCut[kPr], vPtpcMaxCut[kPr], vPtofMaxCut[kPr], track.tpcInnerParam(), track.tofExpMom(), vTpcNsig, vTofNsig, track.hasTOF());
}

return false;
Expand Down Expand Up @@ -1083,6 +1092,12 @@ struct FlowEventPlane {
Configurable<float> cLambdaMinPt{"cLambdaMinPt", 0.6, "Lambda Min pT"};
Configurable<float> cLambdaMaxPt{"cLambdaMaxPt", 6.0, "Lambda Max pT"};

// Resolution correction [sqrt(|Qa.Qc|) from CCDB]
Configurable<bool> cDoResCorr{"cDoResCorr", true, "Divide u.Q by sqrt(|Qa.Qc|)"};
Configurable<std::string> cCcdbUrl{"cCcdbUrl", "http://ccdb-test.cern.ch:8080", "url of ccdb"};
Configurable<std::string> cCcdbPath{"cCcdbPath", "Users/y/ypatley/DFOO", "Path for ccdb-object"};
Configurable<int64_t> nolaterthan{"nolaterthan", std::chrono::duration_cast<std::chrono::milliseconds>(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
Expand All @@ -1092,15 +1107,29 @@ struct FlowEventPlane {
float cent = 0.;
std::array<float, 4> vSP = {0., 0., 0., 0.};

// CCDB service and resolution histogram
Service<o2::ccdb::BasicCCDBManager> 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%"};

const AxisSpec axisXYac{600, -6, 6, "Q^{t}Q^{p}"};
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"};
Expand Down Expand Up @@ -1137,14 +1166,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});
Expand Down Expand Up @@ -1211,6 +1248,22 @@ struct FlowEventPlane {
return true;
}

// Load sqrt(|Qa.Qc|) vs centrality from CCDB
void loadResolution()
{
hSqrtQaQc = nullptr;
std::string ccdbPath = static_cast<std::string>(cCcdbPath) + "/QaQc" + "/Run" + std::to_string(cRunNum);
auto ccdbObj = ccdbService->getForTimeStamp<TList>(ccdbPath, nolaterthan.value);
if (!ccdbObj) {
LOGF(warning, "QaQc CCDB OBJECT NOT FOUND: %s", ccdbPath.c_str());
return;
}
hSqrtQaQc = dynamic_cast<TH1F*>(ccdbObj->FindObject("hSqrtQaQc"));
if (!hSqrtQaQc) {
LOGF(warning, "hSqrtQaQc not found in %s", ccdbPath.c_str());
}
}

template <ParticleType part, typename T>
void getIdFlow(T const& tracks)
{
Expand All @@ -1230,11 +1283,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
Expand Down Expand Up @@ -1390,12 +1443,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<aod::BCsWithTimestamps>().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.;
Expand All @@ -1411,15 +1487,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);
}
}
}
Expand Down
Loading