Skip to content
Closed
Show file tree
Hide file tree
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
104 changes: 61 additions & 43 deletions PWGCF/Flow/TableProducer/zdcQVectors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#include <string_view>
#include <vector>

#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, (DEFAULT), (HELP)};

using namespace o2;
using namespace o2::framework;
Expand Down Expand Up @@ -200,7 +200,7 @@ struct ZdcQVectors {
std::unique_ptr<TF1> fMultCutHigh = nullptr;
std::unique_ptr<TF1> fMultMultPVCut = nullptr;

Service<ccdb::BasicCCDBManager> ccdb;
Service<ccdb::BasicCCDBManager> ccdb{};

// keep track of calibration histos for each given step and iteration
struct Calib {
Expand Down Expand Up @@ -713,7 +713,13 @@ struct ZdcQVectors {
hist = dynamic_cast<T*>(list->FindObject(Form("%s", objName)));
} else if (cm == kTimestamp) {
auto list = dynamic_cast<TList*>(cal.calibList[cm]->FindObject(Form("it%i_step%i", iteration, step)));
if (!list) {
LOGF(fatal, "No calibration list for iteration %i and step %i", iteration, step);
}
hist = dynamic_cast<T*>(list->FindObject(Form("%s", objName)));
if (!hist) {
LOGF(fatal, "No calibration histo for iteration %i and step %i -> %s", iteration, step, objName);
}
} else if (cm == kRec) {
auto list = dynamic_cast<TList*>(cal.calibList[cm]->FindObject(Form("it%i_step%i", iteration, step)));
if (!list) {
Expand All @@ -733,55 +739,61 @@ struct ZdcQVectors {
if (hist->InheritsFrom("TProfile2D")) {
// needed for energy calibration!
auto h = dynamic_cast<TProfile2D*>(hist);
TString name = h->GetName();
int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", cal.runnumber));
int bin = h->GetYaxis()->FindBin(cal.centrality);
calibConstant = h->GetBinContent(binrunnumber, bin);
if (h) {
TString name = h->GetName();
int binrunnumber = h->GetXaxis()->FindBin(TString::Format("%d", cal.runnumber));
int bin = h->GetYaxis()->FindBin(cal.centrality);
calibConstant = h->GetBinContent(binrunnumber, bin);
}
} else if (hist->InheritsFrom("TProfile")) {
auto h = dynamic_cast<TProfile*>(hist);
TString name = h->GetName();
int bin{};
if (name.Contains("mean_vx")) {
bin = h->GetXaxis()->FindBin(cal.v[0]);
}
if (name.Contains("mean_vy")) {
bin = h->GetXaxis()->FindBin(cal.v[1]);
}
if (name.Contains("mean_vz")) {
bin = h->GetXaxis()->FindBin(cal.v[2]);
}
if (name.Contains("mean_cent")) {
bin = h->GetXaxis()->FindBin(cal.centrality);
}
if (name.Contains("vertex")) {
bin = h->GetXaxis()->FindBin(TString::Format("%i", cal.runnumber));
}
if (name.Contains("timestamp")) {
bin = h->GetXaxis()->FindBin(cal.timestamp);
if (h) {
TString name = h->GetName();
int bin{};
if (name.Contains("mean_vx")) {
bin = h->GetXaxis()->FindBin(cal.v[0]);
}
if (name.Contains("mean_vy")) {
bin = h->GetXaxis()->FindBin(cal.v[1]);
}
if (name.Contains("mean_vz")) {
bin = h->GetXaxis()->FindBin(cal.v[2]);
}
if (name.Contains("mean_cent")) {
bin = h->GetXaxis()->FindBin(cal.centrality);
}
if (name.Contains("vertex")) {
bin = h->GetXaxis()->FindBin(TString::Format("%i", cal.runnumber));
}
if (name.Contains("timestamp")) {
bin = h->GetXaxis()->FindBin(cal.timestamp);
}
calibConstant = h->GetBinContent(bin);
}
calibConstant = h->GetBinContent(bin);
} else if (hist->InheritsFrom("THnSparse")) {
std::vector<int> sparsePars;
auto h = dynamic_cast<THnSparseD*>(hist);
sparsePars.push_back(h->GetAxis(0)->FindBin(cal.centrality));
sparsePars.push_back(h->GetAxis(1)->FindBin(cal.v[0]));
sparsePars.push_back(h->GetAxis(2)->FindBin(cal.v[1]));
sparsePars.push_back(h->GetAxis(3)->FindBin(cal.v[2]));
if (h) {
sparsePars.push_back(h->GetAxis(0)->FindBin(cal.centrality));
sparsePars.push_back(h->GetAxis(1)->FindBin(cal.v[0]));
sparsePars.push_back(h->GetAxis(2)->FindBin(cal.v[1]));
sparsePars.push_back(h->GetAxis(3)->FindBin(cal.v[2]));

for (std::size_t i = 0; i < sparsePars.size(); i++) {
h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]);
}

for (std::size_t i = 0; i < sparsePars.size(); i++) {
h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]);
}
auto tempProj = h->Projection(4);
calibConstant = tempProj->GetMean();

auto tempProj = h->Projection(4);
calibConstant = tempProj->GetMean();
if (tempProj->GetEntries() < cfgMinEntriesSparseBin) {
LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)");
calibConstant = 0;
cal.isSelected = false;
}

if (tempProj->GetEntries() < cfgMinEntriesSparseBin) {
LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)");
calibConstant = 0;
cal.isSelected = false;
delete tempProj;
}

delete tempProj;
}

return calibConstant;
Expand Down Expand Up @@ -1157,8 +1169,14 @@ struct ZdcQVectors {
if (!cfgCCDBdir_Shift.value.empty() && !cal.isShiftProfileFound) {
LOGF(info, "Getting shift profile from CCDB for runnumber: %d", runnumber);
TList* hcorrList = ccdb->getForTimeStamp<TList>(cfgCCDBdir_Shift.value, foundBC.timestamp());
cal.shiftprofileC = dynamic_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
cal.shiftprofileA = dynamic_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
auto shiftProfileC = dynamic_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCC"));
if (shiftProfileC) {
cal.shiftprofileC = shiftProfileC;
}
auto shiftProfileA = dynamic_cast<TProfile3D*>(hcorrList->FindObject("ShiftZDCA"));
if (shiftProfileA) {
cal.shiftprofileA = shiftProfileA;
}
if (!cal.shiftprofileC || !cal.shiftprofileA) {
LOGF(error, "Shift profile not found in CCDB for runnumber: %d", runnumber);
cal.isShiftProfileFound = false;
Expand Down
30 changes: 16 additions & 14 deletions Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ struct SpectatorPlaneTutorial {
AxisSpec axisEta = {64, -1.6, 1.6, "#eta"};
AxisSpec axisEtaVn = {8, -.8, .8, "#eta"};
AxisSpec axisCent = {90, 0, 90, "Centrality(%)"};
AxisSpec axisPhiPlane = {100, -constants::math::PI, constants::math::PI, "#Psi"};
AxisSpec axisQQ = {100, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"};
AxisSpec axisPhiPlane = {40, -constants::math::PI, constants::math::PI, "#Psi"};
AxisSpec axisQQ = {10, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"};

std::vector<double> ptbinning = {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, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10};
AxisSpec axisPt = {ptbinning, "#it{p}_{T} GeV/#it{c}"};
Expand All @@ -127,13 +127,13 @@ struct SpectatorPlaneTutorial {
registry.add("CalibHistos/hEvPlaneRes", "Event Plane Resolution; #Events; Event Plane Resolution", {HistType::kTProfile, {axisCent}});

// Flow Histograms
registry.add("flow/v1A", "", {HistType::kTProfile, {axisPt}});
registry.add("flow/v1C", "", {HistType::kTProfile, {axisPt}});
registry.add("flow/v1A", "", {HistType::kTProfile, {axisEtaVn}});
registry.add("flow/v1C", "", {HistType::kTProfile, {axisEtaVn}});

registry.add("flow/vnAxCxUxMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/vnAyCyUxMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/vnAxCyUyMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/vnAyCxUyMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/v2AxCxUxMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/v2AyCyUxMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/v2AxCyUyMH", "", {HistType::kTProfile, {axisCent}});
registry.add("flow/v2AyCxUyMH", "", {HistType::kTProfile, {axisCent}});
}

void process(ZDCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks)
Expand All @@ -147,7 +147,7 @@ struct SpectatorPlaneTutorial {
float centMin = 0;
float centMax = 80;

if (centrality > centMax || centrality < centMin)
if (centrality >= centMax || centrality < centMin)
return;

if (collision.isSelected() == false)
Expand All @@ -174,10 +174,10 @@ struct SpectatorPlaneTutorial {
// Fill the q-vector correlations
registry.fill(HIST("qAqCXY"), centrality, qxA * qxC + qyA * qyC);

double corrQQx = 1;
double corrQQy = 1;
double corrQQ = 1;
double evPlaneRes = 1;
double corrQQx = 1.0;
double corrQQy = 1.0;
double corrQQ = 1.0;
double evPlaneRes = 1.0;

// Get QQ-correlations from CCDB
if (cfgCCDBdir_QQ.value.empty() == false) {
Expand All @@ -200,7 +200,6 @@ struct SpectatorPlaneTutorial {
}

for (const auto& track : tracks) {

// constrain angle to 0 -> [0,0+2pi]
auto phi = RecoDecay::constrainAngle(track.phi(), 0);

Expand All @@ -210,6 +209,9 @@ struct SpectatorPlaneTutorial {
double uxMH = std::cos(2 * phi);
double uyMH = std::sin(2 * phi);

if (corrQQ == 0 || corrQQx == 0 || corrQQy == 0)
continue;

double v1A = (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ));
double v1C = (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ));

Expand Down
Loading