Skip to content
10 changes: 10 additions & 0 deletions Common/DataModel/Qvectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ DECLARE_SOA_COLUMN(LabelsTPCpos, labelsTPCpos, std::vector<int>);
DECLARE_SOA_COLUMN(LabelsTPCneg, labelsTPCneg, std::vector<int>);
DECLARE_SOA_COLUMN(LabelsTPCall, labelsTPCall, std::vector<int>);

// Normalized amplitudes for Event-shape Engineering
DECLARE_SOA_COLUMN(QVecRedFT0C, qVecRedFT0C, float);
DECLARE_SOA_COLUMN(QVecRedTpcPos, qVecRedTpcPos, float);
DECLARE_SOA_COLUMN(QVecRedTpcNeg, qVecRedTpcNeg, float);
DECLARE_SOA_COLUMN(QVecRedTpcAll, qVecRedTpcAll, float);

// Deprecated, will be removed in future after transition time //
DECLARE_SOA_COLUMN(QvecBPosReVec, qvecBPosReVec, std::vector<float>);
DECLARE_SOA_COLUMN(QvecBPosImVec, qvecBPosImVec, std::vector<float>);
Expand Down Expand Up @@ -121,6 +127,8 @@ DECLARE_SOA_TABLE(QvectorTPCposVecs, "AOD", "QVECTORSTPCPVEC", qvec::IsCalibrate
DECLARE_SOA_TABLE(QvectorTPCnegVecs, "AOD", "QVECTORSTPCNVEC", qvec::IsCalibrated, qvec::QvecTPCnegReVec, qvec::QvecTPCnegImVec, qvec::NTrkTPCneg, qvec::LabelsTPCneg);
DECLARE_SOA_TABLE(QvectorTPCallVecs, "AOD", "QVECTORSTPCAVEC", qvec::IsCalibrated, qvec::QvecTPCallReVec, qvec::QvecTPCallImVec, qvec::NTrkTPCall, qvec::LabelsTPCall);

DECLARE_SOA_TABLE(QvectorsReds, "AOD", "QVECTORSRED", qvec::QVecRedFT0C, qvec::QVecRedTpcPos, qvec::QVecRedTpcNeg, qvec::QVecRedTpcAll);

using QvectorFT0C = QvectorFT0Cs::iterator;
using QvectorFT0A = QvectorFT0As::iterator;
using QvectorFT0M = QvectorFT0Ms::iterator;
Expand All @@ -137,6 +145,8 @@ using QvectorTPCposVec = QvectorTPCposVecs::iterator;
using QvectorTPCnegVec = QvectorTPCnegVecs::iterator;
using QvectorTPCallVec = QvectorTPCallVecs::iterator;

using QvectorRed = QvectorsReds::iterator;

// Deprecated, will be removed in future after transition time //
DECLARE_SOA_TABLE(QvectorBPoss, "AOD", "QVECTORSBPOS", qvec::IsCalibrated, qvec::QvecBPosRe, qvec::QvecBPosIm, qvec::NTrkBPos, qvec::LabelsBPos);
DECLARE_SOA_TABLE(QvectorBNegs, "AOD", "QVECTORSBNEG", qvec::IsCalibrated, qvec::QvecBNegRe, qvec::QvecBNegIm, qvec::NTrkBNeg, qvec::LabelsBNeg);
Expand Down
24 changes: 24 additions & 0 deletions Common/TableProducer/qVectorsTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <TString.h>

#include <chrono>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <string>
Expand Down Expand Up @@ -110,6 +111,7 @@
Configurable<bool> cfgUseTPCpos{"cfgUseTPCpos", false, "Initial value for using TPCpos. By default obtained from DataModel."};
Configurable<bool> cfgUseTPCneg{"cfgUseTPCneg", false, "Initial value for using TPCneg. By default obtained from DataModel."};
Configurable<bool> cfgUseTPCall{"cfgUseTPCall", false, "Initial value for using TPCall. By default obtained from DataModel."};
Configurable<bool> cfgProduceRedQVecs{"cfgProduceRedQVecs", false, "Produce reduced Q-vectors for Event-Shape Engineering"};

// Table.
Produces<aod::Qvectors> qVector;
Expand All @@ -129,6 +131,8 @@
Produces<aod::QvectorTPCnegVecs> qVectorTPCnegVec;
Produces<aod::QvectorTPCallVecs> qVectorTPCallVec;

Produces<aod::QvectorsReds> qVectorRed;

std::vector<float> FT0RelGainConst{};
std::vector<float> FV0RelGainConst{};

Expand Down Expand Up @@ -286,7 +290,7 @@
fullPath += "/FT0";
const auto objft0Gain = getForTsOrRun<std::vector<float>>(fullPath, timestamp, runnumber);
if (!objft0Gain || cfgCorrLevel == 0) {
for (auto i{0u}; i < 208; i++) {

Check failure on line 293 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
FT0RelGainConst.push_back(1.);
}
} else {
Expand All @@ -297,7 +301,7 @@
fullPath += "/FV0";
const auto objfv0Gain = getForTsOrRun<std::vector<float>>(fullPath, timestamp, runnumber);
if (!objfv0Gain || cfgCorrLevel == 0) {
for (auto i{0u}; i < 48; i++) {

Check failure on line 304 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
FV0RelGainConst.push_back(1.);
}
} else {
Expand Down Expand Up @@ -377,7 +381,7 @@
helperEP.SumQvectors(0, FT0AchId, ampl / FT0RelGainConst[FT0AchId], nmode, QvecDet, sumAmplFT0A, ft0geom, fv0geom);
helperEP.SumQvectors(0, FT0AchId, ampl / FT0RelGainConst[FT0AchId], nmode, QvecFT0M, sumAmplFT0M, ft0geom, fv0geom);
}
if (sumAmplFT0A > 1e-8) {

Check failure on line 384 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecDet /= sumAmplFT0A;
qVectFT0A[0] = QvecDet.Re();
qVectFT0A[1] = QvecDet.Im();
Expand All @@ -400,7 +404,7 @@
helperEP.SumQvectors(0, FT0CchId, ampl / FT0RelGainConst[FT0CchId], nmode, QvecFT0M, sumAmplFT0M, ft0geom, fv0geom);
}

if (sumAmplFT0C > 1e-8) {

Check failure on line 407 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecDet /= sumAmplFT0C;
qVectFT0C[0] = QvecDet.Re();
qVectFT0C[1] = QvecDet.Im();
Expand All @@ -413,7 +417,7 @@
qVectFT0C[1] = -999.;
}

if (sumAmplFT0M > 1e-8 && useDetector["QvectorFT0Ms"]) {

Check failure on line 420 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecFT0M /= sumAmplFT0M;
qVectFT0M[0] = QvecFT0M.Re();
qVectFT0M[1] = QvecFT0M.Im();
Expand Down Expand Up @@ -444,7 +448,7 @@
helperEP.SumQvectors(1, FV0AchId, ampl / FV0RelGainConst[FV0AchId], nmode, QvecDet, sumAmplFV0A, ft0geom, fv0geom);
}

if (sumAmplFV0A > 1e-8) {

Check failure on line 451 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecDet /= sumAmplFV0A;
qVectFV0A[0] = QvecDet.Re();
qVectFV0A[1] = QvecDet.Im();
Expand Down Expand Up @@ -476,7 +480,7 @@
qVectTPCall[1] += trk.pt() * std::sin(trk.phi() * nmode);
TrkTPCallLabel.push_back(trk.globalIndex());
nTrkTPCall++;
if (std::abs(trk.eta()) < 0.1) {

Check failure on line 483 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}
if (trk.eta() > 0 && (useDetector["QvectorTPCposs"] || useDetector["QvectorBPoss"])) {
Expand Down Expand Up @@ -515,15 +519,15 @@
qVectTPCall[1] = 999.;
}

for (auto i{0u}; i < 4; i++) {

Check failure on line 522 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecRe.push_back(qVectFT0C[0]);
QvecIm.push_back(qVectFT0C[1]);
}
for (auto i{0u}; i < 4; i++) {

Check failure on line 526 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecRe.push_back(qVectFT0A[0]);
QvecIm.push_back(qVectFT0A[1]);
}
for (auto i{0u}; i < 4; i++) {

Check failure on line 530 in Common/TableProducer/qVectorsTable.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
QvecRe.push_back(qVectFT0M[0]);
QvecIm.push_back(qVectFT0M[1]);
}
Expand Down Expand Up @@ -728,6 +732,26 @@
if (useDetector["QvectorTPCalls"])
qVectorTPCall(IsCalibrated, qvecReTPCall.at(0), qvecImTPCall.at(0), qvecAmp[kTPCall], TrkTPCallLabel);

double qVecRedFT0C{-999.}, qVecRedTpcPos{-999.}, qVecRedTpcNeg{-999.}, qVecRedTpcAll{-999.};
if (cfgProduceRedQVecs) {
// Correct normalization to remove multiplicity dependence,
// taking into account that the Q-vector is normalized by 1/M
// and the EsE reduced Q-vector must be normalized to 1/sqrt(M)
if (useDetector["QvectorFT0Cs"]) {
qVecRedFT0C = std::hypot(qvecReFT0C.at(0), qvecImFT0C.at(0)) * std::sqrt(qvecAmp[kFT0C]);
}
if (useDetector["QvectorTPCposs"]) {
qVecRedTpcPos = std::hypot(qvecReTPCpos.at(0), qvecImTPCpos.at(0)) * std::sqrt(qvecAmp[kTPCpos]);
}
if (useDetector["QvectorTPCnegs"]) {
qVecRedTpcNeg = std::hypot(qvecReTPCneg.at(0), qvecImTPCneg.at(0)) * std::sqrt(qvecAmp[kTPCneg]);
}
if (useDetector["QvectorTPCalls"]) {
qVecRedTpcAll = std::hypot(qvecReTPCall.at(0), qvecImTPCall.at(0)) * std::sqrt(qvecAmp[kTPCall]);
}
}
qVectorRed(qVecRedFT0C, qVecRedTpcPos, qVecRedTpcNeg, qVecRedTpcAll);

qVectorFT0CVec(IsCalibrated, qvecReFT0C, qvecImFT0C, qvecAmp[kFT0C]);
qVectorFT0AVec(IsCalibrated, qvecReFT0A, qvecImFT0A, qvecAmp[kFT0A]);
qVectorFT0MVec(IsCalibrated, qvecReFT0M, qvecImFT0M, qvecAmp[kFT0M]);
Expand Down
Loading
Loading