Skip to content

Commit a3f8cc7

Browse files
authored
[PWGUD] add Nchvsetagaps (#18402)
1 parent 2f3ffe9 commit a3f8cc7

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

‎PWGUD/Tasks/flowCumulantsUpc.cxx‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <Math/GenVector/PxPyPzE4D.h>
4040
#include <TF1.h>
4141
#include <TH1.h>
42+
#include <TH2.h>
4243
#include <TH3.h>
4344
#include <TNamed.h>
4445
#include <TObjArray.h>
@@ -159,6 +160,7 @@ struct FlowCumulantsUpc {
159160
TRandom3* fRndmMc = new TRandom3(0);
160161
int lastRunNumber = -1;
161162
std::vector<int> runNumbers;
163+
std::map<std::string, int> neventsIdBins;
162164
std::map<int, std::shared_ptr<TH3>> th3sPerRun; // map of TH3 histograms for all runs
163165

164166
using UdTracks = soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksPID>;
@@ -320,6 +322,26 @@ struct FlowCumulantsUpc {
320322
}
321323
}
322324
}
325+
326+
// One Y bin for every FlowContainer IDName already stored in oba.
327+
const int nIdNames = oba->GetEntries();
328+
329+
const AxisSpec axisIdName{nIdNames, 0.5, static_cast<double>(nIdNames) + 0.5, "ID name"};
330+
331+
registry.add("hNeventsVsNch", "Selected events;N_{ch};ID name", {HistType::kTH2D, {axisIndependent, axisIdName}});
332+
333+
auto hNeventsVsNch = registry.get<TH2>(HIST("hNeventsVsNch"));
334+
335+
for (int i = 0; i < nIdNames; ++i) {
336+
auto* observable = dynamic_cast<TNamed*>(oba->At(i));
337+
if (!observable) {
338+
continue;
339+
}
340+
const std::string idName = observable->GetName();
341+
const int yBin = i + 1;
342+
neventsIdBins[idName] = yBin;
343+
hNeventsVsNch->GetYaxis()->SetBinLabel(yBin, idName.c_str());
344+
}
323345
fFC->SetName("FlowContainer");
324346
fFC->SetXAxis(fPtAxis);
325347
fFC->Initialize(oba, axisIndependent, cfgNbootstrap);
@@ -520,6 +542,16 @@ struct FlowCumulantsUpc {
520542
fGFW->CreateRegions();
521543
}
522544

545+
void fillNeventsVsNch(const std::string& idName, double independent)
546+
{
547+
const auto it = neventsIdBins.find(idName);
548+
if (it == neventsIdBins.end()) {
549+
return;
550+
}
551+
552+
registry.fill(HIST("hNeventsVsNch"), independent, static_cast<double>(it->second));
553+
}
554+
523555
void createOutputObjectsForRun(int runNumber)
524556
{
525557
const AxisSpec axisPhi{60, 0.0, constants::math::TwoPI, "#varphi"};
@@ -538,6 +570,7 @@ struct FlowCumulantsUpc {
538570
val = fGFW->Calculate(corrconf, 0, kFALSE).real() / dnx;
539571
if (std::fabs(val) < 1) {
540572
fFC->FillProfile(corrconf.Head.c_str(), cent, val, dnx, rndm);
573+
fillNeventsVsNch(corrconf.Head, cent);
541574
}
542575
return;
543576
}

0 commit comments

Comments
 (0)