Skip to content

Commit 5c4f5a1

Browse files
authored
adding variable bin widths for DCA histos; plus some minor adjustments (#6421)
* adding variable bin widths for DCA histos; plus some minor adjustments * fixing megalinter
1 parent c33c501 commit 5c4f5a1

File tree

4 files changed

+73
-14
lines changed

4 files changed

+73
-14
lines changed

PWGCF/Femto3D/Core/femto3dPairTask.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
// #include "Common/DataModel/Multiplicity.h"
2525

2626
#include <vector>
27+
#include <memory>
2728
#include "TLorentzVector.h"
2829
#include "TVector3.h"
2930
#include "TDatabasePDG.h"
@@ -37,6 +38,45 @@ double particle_mass(int PDGcode)
3738
return TDatabasePDG::Instance()->GetParticle(PDGcode)->Mass();
3839
}
3940

41+
// for the variable binning in 3D DCA histos in the PairMC task
42+
inline std::unique_ptr<double[]> calc_const_bins(const int& N, const float& xmin, const float& xmax) // needed only to calculate bins along X axis for DCA histos (even if the bin width is constant have to use an array since want to have variable bins in Y and Z)
43+
{
44+
auto bins = std::make_unique<double[]>(N + 1);
45+
46+
float wbin = (xmax - xmin) / N;
47+
bins[0] = xmin;
48+
49+
for (int i = 1; i < N + 1; i++) {
50+
bins[i] = bins[i - 1] + wbin;
51+
}
52+
53+
return bins;
54+
}
55+
56+
// for the variable binning in 3D DCA histos in the PairMC task
57+
inline std::unique_ptr<double[]> calc_var_bins(const int& N, const float& xmax, const int& scale)
58+
{
59+
auto bins = std::make_unique<double[]>(N);
60+
61+
float q = std::pow(scale, 1.0 / (0.5 * N)); // q -- common ratio of the geometric progression, estimated through the requested scaling of w_bin
62+
63+
float winit = xmax * (1 - q) / (1 - scale); // initial w_bin is estimated through sum of the bin width (sum of N elements in geometric progression) that must be equal to xmax
64+
65+
float bin_edge = 0.5 * winit;
66+
bins[0.5 * N - 1] = -bin_edge; // first bin edge left to the center (i.e. 0)
67+
bins[0.5 * N] = bin_edge; // first bin edge right to the center (i.e. 0)
68+
bins[0] = -xmax;
69+
bins[N - 1] = xmax;
70+
71+
for (int i = 1; i < 0.5 * N - 1; i++) {
72+
bin_edge += winit * pow(q, i);
73+
bins[0.5 * N - 1 - i] = -bin_edge;
74+
bins[0.5 * N + i] = bin_edge;
75+
}
76+
77+
return bins;
78+
}
79+
4080
namespace o2::aod::singletrackselector
4181
{
4282
template <typename Type>

PWGCF/Femto3D/Tasks/femto3dPairTask.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ struct FemtoCorrelations {
228228
continue;
229229

230230
for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) {
231-
auto hDblTrk_SE = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects/SE_cent%i_kT%i", i, i, j) + suffix[f], Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j) + suffix[f], kTH2F, {{628, -M_PI / 2.0, M_PI / 2.0, "dphi*"}, {200, -0.5, 0.5, "deta"}});
232-
auto hDblTrk_ME = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects/ME_cent%i_kT%i", i, i, j) + suffix[f], Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j) + suffix[f], kTH2F, {{628, -M_PI / 2.0, M_PI / 2.0, "dphi*"}, {200, -0.5, 0.5, "deta"}});
231+
auto hDblTrk_SE = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects/SE_cent%i_kT%i", i, i, j) + suffix[f], Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j) + suffix[f], kTH2F, {{101, -0.2, 0.2, "dphi*"}, {101, -0.2, 0.2, "deta"}});
232+
auto hDblTrk_ME = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects/ME_cent%i_kT%i", i, i, j) + suffix[f], Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j) + suffix[f], kTH2F, {{101, -0.2, 0.2, "dphi*"}, {101, -0.2, 0.2, "deta"}});
233233

234234
DoubleTrack_SE_histos_perMult.push_back(std::move(hDblTrk_SE));
235235
DoubleTrack_ME_histos_perMult.push_back(std::move(hDblTrk_ME));

PWGCF/Femto3D/Tasks/femto3dPairTaskMC.cxx

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ struct FemtoCorrelationsMC {
8585
Configurable<std::vector<float>> _kTbins{"kTbins", std::vector<float>{0.0f, 100.0f}, "pair transverse momentum kT binning"};
8686
ConfigurableAxis CFkStarBinning{"CFkStarBinning", {500, 0.005, 5.005}, "k* binning of the res. matrix (Nbins, lowlimit, uplimit)"};
8787

88+
Configurable<std::vector<float>> _dcaBinning{"dcaBinning", std::vector<float>{151, 0.5f, 8}, "setup for variable binning (geometric progression is used): 1st (int) -- N_bins (must be odd, otherwise will be increased by 1); 2nd (float) -- abs value of the edge of axises in histos (-2nd, +2nd); 3d (int) -- desired ratio between w_bin at the edges and at 0;"};
89+
8890
bool IsIdentical;
8991

9092
std::pair<int, std::vector<float>> TPCcuts_1;
@@ -141,12 +143,22 @@ struct FemtoCorrelationsMC {
141143
TPCcuts_2 = std::make_pair(_particlePDG_2, _tpcNSigma_2);
142144
TOFcuts_2 = std::make_pair(_particlePDG_2, _tofNSigma_2);
143145

146+
int N = _dcaBinning.value[0]; // number of bins -- must be odd otherwise will be increased by 1
147+
if (N % 2 != 1)
148+
N += 1;
149+
auto var_bins = calc_var_bins(N + 1, _dcaBinning.value[1], static_cast<int>(_dcaBinning.value[2]));
150+
auto const_bins = calc_const_bins(100, 0., 5.0);
151+
144152
for (unsigned int i = 0; i < _centBins.value.size() - 1; i++) {
145153

146154
std::map<int, std::shared_ptr<TH3>> DCA_histos_1_perMult;
147-
DCA_histos_1_perMult[0] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) primary"}, {500, -0.5, 0.5, "DCA_Z(pt) primary"}});
148-
DCA_histos_1_perMult[1] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) weakdecay"}, {500, -0.5, 0.5, "DCA_Z(pt) weakdecay"}});
149-
DCA_histos_1_perMult[2] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) material"}, {500, -0.5, 0.5, "DCA_Z(pt) material"}});
155+
DCA_histos_1_perMult[0] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) primary"}, {1, 0, 1, "DCA_Z(pt) primary"}});
156+
DCA_histos_1_perMult[1] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) weakdecay"}, {1, 0, 1, "DCA_Z(pt) weakdecay"}});
157+
DCA_histos_1_perMult[2] = registry.add<TH3>(Form("Cent%i/FirstParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) material"}, {1, 0, 1, "DCA_Z(pt) material"}});
158+
159+
DCA_histos_1_perMult[0]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]); // set variable bins in Y and Z axis; constant on X
160+
DCA_histos_1_perMult[1]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]);
161+
DCA_histos_1_perMult[2]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]);
150162

151163
std::map<int, std::shared_ptr<TH1>> Purity_histos_1_perMult;
152164
Purity_histos_1_perMult[11] = registry.add<TH1>(Form("Cent%i/FirstParticle/pSpectraEl", i), "pSpectraEl", kTH1F, {{100, 0., 5., "p"}});
@@ -162,9 +174,13 @@ struct FemtoCorrelationsMC {
162174

163175
if (!IsIdentical) {
164176
std::map<int, std::shared_ptr<TH3>> DCA_histos_2_perMult;
165-
DCA_histos_2_perMult[0] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) primary"}, {500, -0.5, -0.5, "DCA_Z(pt) primary"}});
166-
DCA_histos_2_perMult[1] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) weakdecay"}, {500, -0.5, 0.5, "DCA_Z(pt) weakdecay"}});
167-
DCA_histos_2_perMult[2] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "DCA_XY(pt) material"}, {500, -0.5, 0.5, "DCA_Z(pt) material"}});
177+
DCA_histos_2_perMult[0] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_primary", i), "dcaxyz_vs_pt_primary", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) primary"}, {1, 0, 1, "DCA_Z(pt) primary"}});
178+
DCA_histos_2_perMult[1] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_weakdecay", i), "dcaxyz_vs_pt_weakdecay", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) weakdecay"}, {1, 0, 1, "DCA_Z(pt) weakdecay"}});
179+
DCA_histos_2_perMult[2] = registry.add<TH3>(Form("Cent%i/SecondParticle/dcaxyz_vs_pt_material", i), "dcaxyz_vs_pt_material", kTH3F, {{1, 0, 1, "pt"}, {1, 0, 1, "DCA_XY(pt) material"}, {1, 0, 1, "DCA_Z(pt) material"}});
180+
181+
DCA_histos_2_perMult[0]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]); // set variable bins in Y and Z axis; constant on X
182+
DCA_histos_2_perMult[1]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]);
183+
DCA_histos_2_perMult[2]->SetBins(100, &const_bins[0], N, &var_bins[0], N, &var_bins[0]);
168184

169185
std::map<int, std::shared_ptr<TH1>> Purity_histos_2_perMult;
170186
Purity_histos_2_perMult[11] = registry.add<TH1>(Form("Cent%i/SecondParticle/pSpectraEl", i), "pSpectraEl", kTH1F, {{100, 0., 5., "p"}});
@@ -187,8 +203,8 @@ struct FemtoCorrelationsMC {
187203
for (unsigned int j = 0; j < _kTbins.value.size() - 1; j++) {
188204
auto kT_tmp = registry.add<TH1>(Form("Cent%i/kT_cent%i_kT%i", i, i, j), Form("kT_cent%i_kT%i", i, j), kTH1F, {{500, 0., 5., "kT"}});
189205
auto Res_tmp = registry.add<TH2>(Form("Cent%i/ResolutionMatrix_cent%i_kT%i", i, i, j), Form("ResolutionMatrix_rec(gen)_cent%i_kT%i", i, j), kTH2F, {{CFkStarBinning, "k*_gen (GeV/c)"}, {CFkStarBinning, "k*_rec (GeV/c)"}});
190-
auto DblTrk_SE_tmp = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects_SE_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j), kTH2F, {{628, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}});
191-
auto DblTrk_ME_tmp = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects_ME_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j), kTH2F, {{628, -M_PI, M_PI, "dphi*"}, {200, -0.5, 0.5, "deta"}});
206+
auto DblTrk_SE_tmp = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects_SE_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_SE_cent%i_kT%i", i, j), kTH2F, {{101, -0.2, 0.2, "dphi*"}, {101, -0.2, 0.2, "deta"}});
207+
auto DblTrk_ME_tmp = registry.add<TH2>(Form("Cent%i/DoubleTrackEffects_ME_cent%i_kT%i", i, i, j), Form("DoubleTrackEffects_deta(dphi*)_ME_cent%i_kT%i", i, j), kTH2F, {{101, -0.2, 0.2, "dphi*"}, {101, -0.2, 0.2, "deta"}});
192208
kThistos_perMult.push_back(std::move(kT_tmp));
193209
Resolution_histos_perMult.push_back(std::move(Res_tmp));
194210
DoubleTrack_SE_histos_perMult.push_back(std::move(DblTrk_SE_tmp));
@@ -253,6 +269,9 @@ struct FemtoCorrelationsMC {
253269
{ // template for ME
254270
for (auto ii : tracks1) {
255271
for (auto iii : tracks2) {
272+
if (abs(ii->pdgCode()) != _particlePDG_1.value || abs(iii->pdgCode()) != _particlePDG_2.value)
273+
continue;
274+
256275
Pair->SetPair(ii, iii);
257276
float pair_kT = Pair->GetKt();
258277

PWGCF/Femto3D/Tasks/femto3dQA.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ struct QAHistograms {
100100
registry.add("p", "p", kTH1F, {{100, 0., 5., "p"}});
101101
registry.add("pt", "pt", kTH1F, {{100, 0., 5., "pt"}});
102102
registry.add("sign", "sign", kTH1F, {{3, -1.5, 1.5, "sign"}});
103-
registry.add("dcaxy_to_p", "dcaxy_to_p", kTH2F, {{100, 0., 5.0, "p"}, {500, -0.5, 0.5, "dcaxy"}});
104-
registry.add("dcaxy_to_pt", "dcaxy_to_pt", kTH2F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "dcaxy"}});
105-
registry.add("dcaz_to_p", "dcaz_to_p", kTH2F, {{100, 0., 5., "p"}, {500, -0.5, 0.5, "dcaz"}});
106-
registry.add("dcaz_to_pt", "dcaz_to_pt", kTH2F, {{100, 0., 5., "pt"}, {500, -0.5, 0.5, "dcaz"}});
103+
registry.add("dcaxy_to_p", "dcaxy_to_p", kTH2F, {{100, 0., 5.0, "p"}, {501, -0.5, 0.5, "dcaxy"}});
104+
registry.add("dcaxy_to_pt", "dcaxy_to_pt", kTH2F, {{100, 0., 5., "pt"}, {501, -0.5, 0.5, "dcaxy"}});
105+
registry.add("dcaz_to_p", "dcaz_to_p", kTH2F, {{100, 0., 5., "p"}, {501, -0.5, 0.5, "dcaz"}});
106+
registry.add("dcaz_to_pt", "dcaz_to_pt", kTH2F, {{100, 0., 5., "pt"}, {501, -0.5, 0.5, "dcaz"}});
107107
registry.add("TPCClusters", "TPCClusters", kTH1F, {{163, -0.5, 162.5, "NTPCClust"}});
108108
registry.add("TPCCrossedRowsOverFindableCls", "TPCCrossedRowsOverFindableCls", kTH1F, {{100, 0.0, 10.0, "NcrossedRowsOverFindable"}});
109109
registry.add("TPCFractionSharedCls", "TPCFractionSharedCls", kTH1F, {{100, 0.0, 1.0, "TPCsharedFraction"}});

0 commit comments

Comments
 (0)