Skip to content

Commit 9f0f3ce

Browse files
authored
[Common] updates to ese tables (AliceO2Group#9293)
1 parent a8418ac commit 9f0f3ce

File tree

4 files changed

+165
-134
lines changed

4 files changed

+165
-134
lines changed

Common/Core/FFitWeights.cxx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
#include "FFitWeights.h"
1818

19+
#include <string>
20+
#include <cstdio>
21+
#include <vector>
22+
1923
#include <TSpline.h>
2024

2125
ClassImp(FFitWeights)
@@ -43,30 +47,30 @@ FFitWeights::~FFitWeights()
4347
delete qAxis;
4448
};
4549

46-
void FFitWeights::Init()
50+
void FFitWeights::init()
4751
{
4852
fW_data = new TObjArray();
4953
fW_data->SetName("FFitWeights_Data");
5054
fW_data->SetOwner(kTRUE);
5155

5256
if (!qAxis)
53-
this->SetBinAxis(500, 0, 25);
57+
this->setBinAxis(500, 0, 25);
5458
for (const auto& qn : qnTYPE) {
55-
fW_data->Add(new TH2D(this->GetQName(qn.first, qn.second.c_str()), this->GetAxisName(qn.first, qn.second.c_str()), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax()));
59+
fW_data->Add(new TH2D(this->getQName(qn.first, qn.second.c_str()), this->getAxisName(qn.first, qn.second.c_str()), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax()));
5660
}
5761
};
5862

59-
void FFitWeights::Fill(float centrality, float qn, int nh, const char* pf)
63+
void FFitWeights::fillWeights(float centrality, float qn, int nh, const char* pf)
6064
{
6165
TObjArray* tar{nullptr};
6266

6367
tar = fW_data;
6468
if (!tar)
6569
return;
6670

67-
TH2D* th2 = reinterpret_cast<TH2D*>(tar->FindObject(this->GetQName(nh, pf)));
71+
TH2D* th2 = reinterpret_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf)));
6872
if (!th2) {
69-
tar->Add(new TH2D(this->GetQName(nh, pf), this->GetAxisName(nh, pf), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax()));
73+
tar->Add(new TH2D(this->getQName(nh, pf), this->getAxisName(nh, pf), CentBin, 0, CentBin, qAxis->GetNbins(), qAxis->GetXmin(), qAxis->GetXmax()));
7074
th2 = reinterpret_cast<TH2D*>(tar->At(tar->GetEntries() - 1));
7175
}
7276
th2->Fill(centrality, qn);
@@ -83,12 +87,12 @@ Long64_t FFitWeights::Merge(TCollection* collist)
8387
FFitWeights* l_w = 0;
8488
TIter all_w(collist);
8589
while ((l_w = (reinterpret_cast<FFitWeights*>(all_w())))) {
86-
AddArray(fW_data, l_w->GetDataArray());
90+
addArray(fW_data, l_w->getDataArray());
8791
nmerged++;
8892
}
8993
return nmerged;
9094
};
91-
void FFitWeights::AddArray(TObjArray* targ, TObjArray* sour)
95+
void FFitWeights::addArray(TObjArray* targ, TObjArray* sour)
9296
{
9397
if (!sour) {
9498
printf("Source array does not exist!\n");
@@ -107,7 +111,7 @@ void FFitWeights::AddArray(TObjArray* targ, TObjArray* sour)
107111
}
108112
};
109113

110-
void FFitWeights::qSelectionSpline(std::vector<int> nhv, std::vector<std::string> stv) /* only execute OFFLINE */
114+
void FFitWeights::qSelection(std::vector<int> nhv, std::vector<std::string> stv) /* only execute OFFLINE */
111115
{
112116
TObjArray* tar{nullptr};
113117

@@ -117,15 +121,15 @@ void FFitWeights::qSelectionSpline(std::vector<int> nhv, std::vector<std::string
117121

118122
for (const auto& pf : stv) {
119123
for (const auto& nh : nhv) {
120-
TH2D* th2 = reinterpret_cast<TH2D*>(tar->FindObject(this->GetQName(nh, pf.c_str())));
124+
TH2D* th2{reinterpret_cast<TH2D*>(tar->FindObject(this->getQName(nh, pf.c_str())))};
121125
if (!th2) {
122126
printf("qh not found!\n");
123127
return;
124128
}
125129

126-
TH1D* tmp = nullptr;
127-
TGraph* tmpgr = nullptr;
128-
TSpline3* spline = nullptr;
130+
TH1D* tmp{nullptr};
131+
TGraph* tmpgr{nullptr};
132+
// TSpline3* spline = nullptr;
129133
for (int iSP{0}; iSP < 90; iSP++) {
130134
tmp = th2->ProjectionY(Form("q%i_%i_%i", nh, iSP, iSP + 1), iSP + 1, iSP + 1);
131135
std::vector<double> xq(nResolution);
@@ -134,35 +138,36 @@ void FFitWeights::qSelectionSpline(std::vector<int> nhv, std::vector<std::string
134138
xq[i] = static_cast<double>(i + 1) / static_cast<double>(nResolution);
135139
tmp->GetQuantiles(nResolution, yq.data(), xq.data());
136140
tmpgr = new TGraph(nResolution, yq.data(), xq.data());
137-
spline = new TSpline3(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP), tmpgr);
138-
spline->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP));
139-
fW_data->Add(spline);
141+
tmpgr->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP));
142+
// spline = new TSpline3(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP), tmpgr);
143+
// spline->SetName(Form("sp_q%i%s_%i", nh, pf.c_str(), iSP));
144+
fW_data->Add(tmpgr);
140145
}
141146
}
142147
}
143148
};
144149

145-
float FFitWeights::EvalSplines(float centr, const float& dqn, const int nh, const char* pf)
150+
float FFitWeights::eval(float centr, const float& dqn, const int nh, const char* pf)
146151
{
147152
TObjArray* tar{nullptr};
148153

149154
tar = fW_data;
150155
if (!tar)
151156
return -1;
152157

153-
int isp = static_cast<int>(centr);
158+
int isp{static_cast<int>(centr)};
154159
if (isp < 0 || isp > 90) {
155160
return -1;
156161
}
157162

158-
TSpline3* spline = nullptr;
159-
spline = reinterpret_cast<TSpline3*>(tar->FindObject(Form("sp_q%i%s_%i", nh, pf, isp)));
163+
TGraph* spline{nullptr};
164+
spline = reinterpret_cast<TGraph*>(tar->FindObject(Form("sp_q%i%s_%i", nh, pf, isp)));
160165
if (!spline) {
161166
return -1;
162167
}
163168

164-
float qn_val = 100. * spline->Eval(dqn);
165-
if (qn_val < 0) {
169+
float qn_val{static_cast<float>(100. * spline->Eval(dqn))};
170+
if (qn_val < 0 || qn_val > 100.05) {
166171
return -1;
167172
}
168173

Common/Core/FFitWeights.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,23 @@ class FFitWeights : public TNamed
4141
explicit FFitWeights(const char* name);
4242
~FFitWeights();
4343

44-
void Init();
45-
void Fill(float centrality, float qn, int nh, const char* pf = "");
46-
TObjArray* GetDataArray() { return fW_data; }
44+
void init();
45+
void fillWeights(float centrality, float qn, int nh, const char* pf = "");
46+
TObjArray* getDataArray() { return fW_data; }
4747

48-
void SetCentBin(int bin) { CentBin = bin; }
49-
void SetBinAxis(int bin, float min, float max)
48+
void setCentBin(int bin) { CentBin = bin; }
49+
void setBinAxis(int bin, float min, float max)
5050
{
5151
qAxis = new TAxis(bin, min, max);
5252
}
53-
TAxis* GetqVecAx() { return qAxis; }
53+
TAxis* getqVecAx() { return qAxis; }
5454

5555
Long64_t Merge(TCollection* collist);
56-
void qSelectionSpline(std::vector<int> nhv, std::vector<std::string> stv);
57-
float EvalSplines(float centr, const float& dqn, const int nh, const char* pf = "");
58-
void SetResolution(int res) { nResolution = res; }
59-
void SetQnType(std::vector<std::pair<int, std::string>> qninp) { qnTYPE = qninp; }
56+
void qSelection(std::vector<int> nhv, std::vector<std::string> stv);
57+
float eval(float centr, const float& dqn, const int nh, const char* pf = "");
58+
void setResolution(int res) { nResolution = res; }
59+
int getResolution() const { return nResolution; }
60+
void setQnType(std::vector<std::pair<int, std::string>> qninp) { qnTYPE = qninp; }
6061

6162
private:
6263
TObjArray* fW_data;
@@ -67,15 +68,15 @@ class FFitWeights : public TNamed
6768

6869
std::vector<std::pair<int, std::string>> qnTYPE;
6970

70-
const char* GetQName(const int nh, const char* pf = "")
71+
const char* getQName(const int nh, const char* pf = "")
7172
{
7273
return Form("q%i%s", nh, pf);
7374
};
74-
const char* GetAxisName(const int nh, const char* pf = "")
75+
const char* getAxisName(const int nh, const char* pf = "")
7576
{
7677
return Form(";Centrality;q_{%i}^{%s}", nh, pf);
7778
};
78-
void AddArray(TObjArray* targ, TObjArray* sour);
79+
void addArray(TObjArray* targ, TObjArray* sour);
7980

8081
ClassDef(FFitWeights, 1); // calibration class
8182
};

Common/DataModel/EseTable.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@ namespace q_vector
2929
DECLARE_SOA_COLUMN(QPERCFT0C, qPERCFT0C, std::vector<float>);
3030
DECLARE_SOA_COLUMN(QPERCFT0A, qPERCFT0A, std::vector<float>);
3131
DECLARE_SOA_COLUMN(QPERCFV0A, qPERCFV0A, std::vector<float>);
32-
DECLARE_SOA_COLUMN(QPERCTPC, qPERCTPC, std::vector<float>);
33-
DECLARE_SOA_COLUMN(FESECOL, fESECOL, std::vector<int>);
32+
DECLARE_SOA_COLUMN(QPERCTPCall, qPERCTPCall, std::vector<float>);
33+
DECLARE_SOA_COLUMN(QPERCTPCneg, qPERCTPCneg, std::vector<float>);
34+
DECLARE_SOA_COLUMN(QPERCTPCpos, qPERCTPCpos, std::vector<float>);
3435
} // namespace q_vector
3536
DECLARE_SOA_TABLE(QPercentileFT0Cs, "AOD", "QPERCENTILEFT0C", q_vector::QPERCFT0C);
3637
DECLARE_SOA_TABLE(QPercentileFT0As, "AOD", "QPERCENTILEFT0A", q_vector::QPERCFT0A);
3738
DECLARE_SOA_TABLE(QPercentileFV0As, "AOD", "QPERCENTILEFV0A", q_vector::QPERCFV0A);
38-
DECLARE_SOA_TABLE(QPercentileTPCs, "AOD", "QPERCENTILETPC", q_vector::QPERCTPC);
39-
DECLARE_SOA_TABLE(FEseCols, "AOD", "FEVENTSHAPE", q_vector::FESECOL);
39+
DECLARE_SOA_TABLE(QPercentileTPCalls, "AOD", "QPERCENTILETPCall", q_vector::QPERCTPCall);
40+
DECLARE_SOA_TABLE(QPercentileTPCnegs, "AOD", "QPERCENTILETPCneg", q_vector::QPERCTPCneg);
41+
DECLARE_SOA_TABLE(QPercentileTPCposs, "AOD", "QPERCENTILETPCpos", q_vector::QPERCTPCpos);
4042

4143
using QPercentileFT0C = QPercentileFT0Cs::iterator;
4244
using QPercentileFT0A = QPercentileFT0As::iterator;
4345
using QPercentileFV0A = QPercentileFV0As::iterator;
44-
using QPercentileTPC = QPercentileTPCs::iterator;
45-
using FEseCol = FEseCols::iterator;
46+
using QPercentileTPCall = QPercentileTPCalls::iterator;
47+
using QPercentileTPCneg = QPercentileTPCnegs::iterator;
48+
using QPercentileTPCpos = QPercentileTPCposs::iterator;
4649

4750
} // namespace o2::aod
4851

0 commit comments

Comments
 (0)