Skip to content

Commit 7bc0b0c

Browse files
committed
Feat: add new histograms
1 parent 783e2e7 commit 7bc0b0c

17 files changed

+441
-350
lines changed

PWGCF/Femto/Core/collisionHistManager.h

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ enum ColHist {
5151
kCentVsMult,
5252
kCentVsSphericity,
5353
kMultVsSphericity,
54+
// particle number correlation
55+
kNpart1VsNpart2,
56+
kNpart1VsNpart2VsNpart3,
5457
// mc
5558
kTrueCentVsCent,
5659
kTrueMultVsMult,
@@ -79,16 +82,21 @@ constexpr std::array<histmanager::HistInfo<ColHist>, kColHistLast> HistTable = {
7982
{kCentVsMult, o2::framework::kTH2F, "hCentVsMult", "Centrality vs Multiplicity; Centrality (%); Multiplicity"},
8083
{kMultVsSphericity, o2::framework::kTH2F, "hMultVsSphericity", "Multiplicity vs Sphericity; Multiplicity; Sphericity"},
8184
{kCentVsSphericity, o2::framework::kTH2F, "hCentVsSphericity", "Centrality vs Sphericity; Centrality (%); Sphericity"},
85+
// particle number correlation
86+
{kNpart1VsNpart2, o2::framework::kTH2F, "hNpart1VsNpart2", "# particle 1 vs # particle 2; # particle 1; # particle 2"},
87+
{kNpart1VsNpart2VsNpart3, o2::framework::kTHnSparseF, "hNpart1VsNpart2VsNpart3", "# particle 1 vs # particle 2 vs particle 3; # particle 1; # particle 2; # particle 3"},
8288
// mc
8389
{kTrueCentVsCent, o2::framework::kTH2F, "hTrueCentVsCent", "True centrality vs centrality; Centrality_{True} (%); Centrality (%)"},
8490
{kTrueMultVsMult, o2::framework::kTH2F, "hTrueMultVsMult", "True multiplicity vs multiplicity; Multiplicity_{True}; Multiplicity"},
8591
}};
8692

87-
#define COL_HIST_ANALYSIS_MAP(conf) \
88-
{kPosZ, {conf.vtxZ}}, \
89-
{kMult, {conf.mult}}, \
90-
{kCent, {conf.cent}}, \
91-
{kMagField, {conf.magField}},
93+
#define COL_HIST_ANALYSIS_MAP(conf) \
94+
{kPosZ, {conf.vtxZ}}, \
95+
{kMult, {conf.mult}}, \
96+
{kCent, {conf.cent}}, \
97+
{kMagField, {conf.magField}}, \
98+
{kNpart1VsNpart2, {conf.particleCorrelation, conf.particleCorrelation}}, \
99+
{kNpart1VsNpart2VsNpart3, {conf.particleCorrelation, conf.particleCorrelation, conf.particleCorrelation}},
92100

93101
#define COL_HIST_QA_MAP(confAnalysis, confQa) \
94102
{kPosX, {confQa.vtxXY}}, \
@@ -148,6 +156,9 @@ struct ConfCollisionBinning : o2::framework::ConfigurableGroup {
148156
o2::framework::ConfigurableAxis mult{"mult", {200, 0, 200}, "Multiplicity binning"};
149157
o2::framework::ConfigurableAxis cent{"cent", {100, 0.0f, 100.0f}, "Centrality (multiplicity percentile) binning"};
150158
o2::framework::ConfigurableAxis magField{"magField", {11, -5.5, 5.5}, "Magnetic field binning"};
159+
o2::framework::Configurable<bool> plotParticlePairCorrelation{"plotParticlePairCorrelation", false, "Plot particle number correlation for pairs"};
160+
o2::framework::Configurable<bool> plotParticleTripletCorrelation{"plotParticleTripletCorrelation", false, "Plot particle number correlation for triplets"};
161+
o2::framework::ConfigurableAxis particleCorrelation{"particleCorrelation", {6, -0.5f, 5.5f}, "Binning for particle number correlation of pairs/triplets"};
151162
};
152163

153164
struct ConfCollisionQaBinning : o2::framework::ConfigurableGroup {
@@ -165,10 +176,14 @@ class CollisionHistManager
165176
CollisionHistManager() = default;
166177
~CollisionHistManager() = default;
167178

168-
template <modes::Mode mode>
169-
void init(o2::framework::HistogramRegistry* registry, std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs)
179+
template <modes::Mode mode, typename T>
180+
void init(o2::framework::HistogramRegistry* registry,
181+
std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs,
182+
T const& ConfCollisionBinning)
170183
{
171184
mHistogramRegistry = registry;
185+
mPlotPairCorrelation = ConfCollisionBinning.plotParticlePairCorrelation.value;
186+
mPlotTripletCorrelation = ConfCollisionBinning.plotParticleTripletCorrelation.value;
172187
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
173188
initAnalysis(Specs);
174189
}
@@ -186,29 +201,32 @@ class CollisionHistManager
186201
mPlot2d = ConfBinningQa.plot2d.value;
187202
}
188203

189-
template <modes::Mode mode, typename T>
190-
void init(o2::framework::HistogramRegistry* registry, std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs, T const& ConfBinningQa)
204+
template <modes::Mode mode, typename T1, typename T2>
205+
void init(o2::framework::HistogramRegistry* registry,
206+
std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs,
207+
T1 const& ConfCollisionBinning,
208+
T2 const& ConfBinningQa)
191209
{
192210
enableOptionalHistograms(ConfBinningQa);
193-
this->template init<mode>(registry, Specs);
211+
init<mode>(registry, Specs, ConfCollisionBinning);
194212
}
195213

196214
template <modes::Mode mode, typename T>
197-
void fill(T const& col)
215+
void fill(T const& col, int64_t nSlice1, int64_t nSlice2, int64_t nSlice3)
198216
{
199217
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
200-
fillAnalysis(col);
218+
fillAnalysis(col, nSlice1, nSlice2, nSlice3);
201219
}
202220
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
203221
fillQa(col);
204222
}
205223
}
206224

207225
template <modes::Mode mode, typename T1, typename T2>
208-
void fill(T1 const& col, T2 const& mcCols)
226+
void fill(T1 const& col, T2 const& mcCols, int64_t nSlice1, int64_t nSlice2, int64_t nSlice3)
209227
{
210228
if constexpr (isFlagSet(mode, modes::Mode::kAnalysis)) {
211-
fillAnalysis(col);
229+
fillAnalysis(col, nSlice1, nSlice2, nSlice3);
212230
}
213231
if constexpr (isFlagSet(mode, modes::Mode::kQa)) {
214232
fillQa(col);
@@ -226,6 +244,12 @@ class CollisionHistManager
226244
mHistogramRegistry->add(analysisDir + getHistNameV2(kMult, HistTable), getHistDesc(kMult, HistTable), getHistType(kMult, HistTable), {Specs.at(kMult)});
227245
mHistogramRegistry->add(analysisDir + getHistNameV2(kCent, HistTable), getHistDesc(kCent, HistTable), getHistType(kCent, HistTable), {Specs.at(kCent)});
228246
mHistogramRegistry->add(analysisDir + getHistNameV2(kMagField, HistTable), getHistDesc(kMagField, HistTable), getHistType(kMagField, HistTable), {Specs.at(kMagField)});
247+
if (mPlotPairCorrelation) {
248+
mHistogramRegistry->add(analysisDir + getHistNameV2(kNpart1VsNpart2, HistTable), getHistDesc(kNpart1VsNpart2, HistTable), getHistType(kNpart1VsNpart2, HistTable), {Specs.at(kNpart1VsNpart2)});
249+
}
250+
if (mPlotTripletCorrelation) {
251+
mHistogramRegistry->add(analysisDir + getHistNameV2(kNpart1VsNpart2VsNpart3, HistTable), getHistDesc(kNpart1VsNpart2VsNpart3, HistTable), getHistType(kNpart1VsNpart2VsNpart3, HistTable), {Specs.at(kNpart1VsNpart2VsNpart3)});
252+
}
229253
}
230254

231255
void initQa(std::map<ColHist, std::vector<o2::framework::AxisSpec>> const& Specs)
@@ -253,12 +277,18 @@ class CollisionHistManager
253277
}
254278

255279
template <typename T>
256-
void fillAnalysis(T const& col)
280+
void fillAnalysis(T const& col, size_t nSlice1, size_t nSlice2, size_t nSlice3)
257281
{
258282
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kPosZ, HistTable)), col.posZ());
259283
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kMult, HistTable)), col.mult());
260284
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kCent, HistTable)), col.cent());
261285
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kMagField, HistTable)), col.magField());
286+
if (mPlotPairCorrelation) {
287+
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kNpart1VsNpart2, HistTable)), nSlice1, nSlice2);
288+
}
289+
if (mPlotTripletCorrelation) {
290+
mHistogramRegistry->fill(HIST(AnalysisDir) + HIST(getHistName(kNpart1VsNpart2VsNpart3, HistTable)), nSlice1, nSlice2, nSlice3);
291+
}
262292
}
263293

264294
template <typename T>
@@ -290,7 +320,9 @@ class CollisionHistManager
290320
}
291321

292322
o2::framework::HistogramRegistry* mHistogramRegistry = nullptr;
293-
bool mPlot2d = true;
323+
bool mPlot2d = false;
324+
bool mPlotPairCorrelation = false;
325+
bool mPlotTripletCorrelation = false;
294326
}; // namespace femtounitedcolhistmanager
295327
}; // namespace colhistmanager
296328
}; // namespace o2::analysis::femto

0 commit comments

Comments
 (0)