Skip to content

Commit 47c1c03

Browse files
[PWGLF] Fix cast in mcCentralityModule.h (#18818)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 7073ea6 commit 47c1c03

1 file changed

Lines changed: 30 additions & 30 deletions

File tree

‎PWGLF/Utils/mcCentralityModule.h‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -174,20 +174,20 @@ struct BuilderModule {
174174
coreConfigurables baseOpts;
175175

176176
TList* MCCentralityCalibObjects = nullptr;
177-
TH1D* h1dFV0A = nullptr;
178-
TH1D* h1dFT0M = nullptr;
179-
TH1D* h1dFT0A = nullptr;
180-
TH1D* h1dFT0C = nullptr;
181-
TH1D* h1dFT0CVariant1 = nullptr;
182-
TH1D* h1dFT0CVariant2 = nullptr;
183-
TH1D* h1dFDDM = nullptr;
184-
TH1D* h1dNTPV = nullptr;
185-
TH1D* h1dNGlobal = nullptr;
186-
TH1D* h1dMFT = nullptr;
177+
TH1* h1dFV0A = nullptr;
178+
TH1* h1dFT0M = nullptr;
179+
TH1* h1dFT0A = nullptr;
180+
TH1* h1dFT0C = nullptr;
181+
TH1* h1dFT0CVariant1 = nullptr;
182+
TH1* h1dFT0CVariant2 = nullptr;
183+
TH1* h1dFDDM = nullptr;
184+
TH1* h1dNTPV = nullptr;
185+
TH1* h1dNGlobal = nullptr;
186+
TH1* h1dMFT = nullptr;
187187

188188
// Calibration objects for candidate-by-candidate sampling (assignCentralityPerCandidate):
189189
// x = centrality (%) of the matched reconstructed MC collision, y = generated multiplicity (|eta| < 0.5)
190-
std::vector<TH2D*> h2dCentVsGenMult;
190+
std::vector<TH2*> h2dCentVsGenMult;
191191
TRandom3 fRandomSampler;
192192

193193
// QA of the on-the-fly calibration (recalibrateCentrality): mean <N_PV>_{|eta|<0.5} in data and MC
@@ -229,7 +229,7 @@ struct BuilderModule {
229229
// sampled percentile vs the generated multiplicity (|eta| < 0.5) actually used to key the sampling, so
230230
// it can be visually compared against the input calibration (hGenMultEta05VsCentrality<estimator>) to
231231
// check that the sampled distribution reproduces the expected P(centrality|genMult). This is a plain
232-
// TH2D (not a TProfile): unlike the calibration QA above, it stores a distribution to look at, not a
232+
// TH2 (not a TProfile): unlike the calibration QA above, it stores a distribution to look at, not a
233233
// mean to merge, so ordinary bin-content-sum merging across grid jobs is exactly what's wanted here.
234234
template <typename THistoRegistry>
235235
void registerCandidateQAHistos(THistoRegistry& histos, const char* name)
@@ -393,7 +393,7 @@ struct BuilderModule {
393393
return hist;
394394
}
395395

396-
TH1D* extractCentralityCalibration(int idx, const char* name, bool reverse = false)
396+
TH1* extractCentralityCalibration(int idx, const char* name, bool reverse = false)
397397
{
398398

399399
auto CalibMC = [&](TString const& estimator) {
@@ -403,10 +403,10 @@ struct BuilderModule {
403403
std::vector<double> epercentile_center(nCentBins);
404404

405405
// Histograms
406-
TH2D* h2dMultVsCent_Data = getHist<TH2D>(Form("hMultEta05VsCent%s_Data", estimator.Data()));
407-
TH2D* h2dMultRecoVsMultGen_MC = getHist<TH2D>(Form("hMultEta05VsGenMult%s", estimator.Data()));
406+
TH2* h2dMultVsCent_Data = getHist<TH2>(Form("hMultEta05VsCent%s_Data", estimator.Data()));
407+
TH2* h2dMultRecoVsMultGen_MC = getHist<TH2>(Form("hMultEta05VsGenMult%s", estimator.Data()));
408408
if (!h2dMultVsCent_Data || !h2dMultRecoVsMultGen_MC) {
409-
return static_cast<TH1D*>(nullptr);
409+
return static_cast<TH1*>(nullptr);
410410
}
411411

412412
// QA of this on-the-fly calibration: mean <N_PV>_{|eta|<0.5} in data/MC per centrality class,
@@ -416,7 +416,7 @@ struct BuilderModule {
416416
TProfile* hPVData = hCalibPVData[idx].get();
417417
TProfile* hPVMC = hCalibPVMC[idx].get();
418418

419-
TH1D* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX());
419+
TH1* h1dCalib = h2dMultRecoVsMultGen_MC->ProjectionX(Form("h1d%s", estimator.Data()), 1, h2dMultRecoVsMultGen_MC->GetNbinsX());
420420
h1dCalib->Reset();
421421
h1dCalib->SetTitle(Form("%s calibration object", estimator.Data()));
422422
h1dCalib->GetXaxis()->SetTitle(Form("#it{N}_{%s, gen.}", estimator.Data()));
@@ -438,8 +438,8 @@ struct BuilderModule {
438438
for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins
439439
// start from the end (from the high multiplicity collisions)
440440
int irev = i;
441-
TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5),
442-
h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5));
441+
TH1* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] + 1e-5),
442+
h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev + 1] - 1e-5));
443443

444444
double meanMult_Data = projData->GetMean();
445445

@@ -448,7 +448,7 @@ struct BuilderModule {
448448
int endBinMc = startBinMc;
449449
for (int j = startBinMc - 1; j >= 1; j--) {
450450
// Loop over MC bins
451-
TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", j, startBinMc);
451+
TH1* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", j, startBinMc);
452452
int nEntries = projMC->Integral();
453453
double meanMC = projMC->GetMean();
454454
double ldiff = std::abs(meanMC - meanMult_Data);
@@ -469,7 +469,7 @@ struct BuilderModule {
469469
endBinMc = 1;
470470
}
471471

472-
TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), endBinMc, startBinMc);
472+
TH1* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), endBinMc, startBinMc);
473473

474474
// Refill the per-class mean from the underlying (data/MC) multiplicity distributions, bin by
475475
// bin, so the TProfile accumulates real sum(w)/sum(wy)/sum(wy^2) rather than a precomputed mean.
@@ -511,8 +511,8 @@ struct BuilderModule {
511511
for (int i = 0; i < nCentBins; i++) { // Loop over centrality bins
512512
// start from the end (from the low multiplicity collisions)
513513
int irev = nCentBins - i;
514-
TH1D* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5),
515-
h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5));
514+
TH1* projData = h2dMultVsCent_Data->ProjectionY(Form("projData_%d", i), h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev - 1] + 1e-5),
515+
h2dMultVsCent_Data->GetXaxis()->FindBin(centralityBins[irev] - 1e-5));
516516

517517
double meanMult_Data = projData->GetMean();
518518

@@ -521,7 +521,7 @@ struct BuilderModule {
521521
int endBinMc = h1dCalib->GetNbinsX();
522522
for (int j = startBinMc + 1; j <= h1dCalib->GetNbinsX(); j++) {
523523
// Loop over MC bins
524-
TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", startBinMc, j);
524+
TH1* projMC = h2dMultRecoVsMultGen_MC->ProjectionY("", startBinMc, j);
525525
int nEntries = projMC->Integral();
526526
double meanMC = projMC->GetMean();
527527
double ldiff = std::abs(meanMC - meanMult_Data);
@@ -542,7 +542,7 @@ struct BuilderModule {
542542
endBinMc = h2dMultRecoVsMultGen_MC->GetNbinsX();
543543
}
544544

545-
TH1D* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc);
545+
TH1* projMC = h2dMultRecoVsMultGen_MC->ProjectionY(Form("projMC_%d", i), startBinMc, endBinMc);
546546

547547
// Refill the per-class mean from the underlying (data/MC) multiplicity distributions, bin by
548548
// bin, so the TProfile accumulates real sum(w)/sum(wy)/sum(wy^2) rather than a precomputed mean.
@@ -586,7 +586,7 @@ struct BuilderModule {
586586

587587
// Loads the calibration object(s) for a single estimator: either the class-averaged TH1D (statistical
588588
// assignment) or, in candidate-by-candidate mode, the raw joint TH2D used to sample P(centrality|genMult).
589-
void loadEstimatorCalibration(int idx, const char* name, TH1D*& h1dOut)
589+
void loadEstimatorCalibration(int idx, const char* name, TH1*& h1dOut)
590590
{
591591
if (!baseOpts.mEnabledTables[idx]) {
592592
return;
@@ -595,10 +595,10 @@ struct BuilderModule {
595595
// x = reco centrality of the matched MC collision, y = generated multiplicity (|eta| < 0.5)
596596
// filled directly by the calibration-producing task (e.g. centralityQa.cxx); used as-is, no
597597
// mean-matching required since it is already a genuine joint distribution.
598-
h2dCentVsGenMult[idx] = getHist<TH2D>(Form("hGenMultEta05VsCentrality%s", name));
598+
h2dCentVsGenMult[idx] = getHist<TH2>(Form("hGenMultEta05VsCentrality%s", name));
599599
return;
600600
}
601-
h1dOut = baseOpts.recalibrateCentrality ? extractCentralityCalibration(idx, name, baseOpts.recalibrateMode) : getHist<TH1D>(Form("h1d%s", name));
601+
h1dOut = baseOpts.recalibrateCentrality ? extractCentralityCalibration(idx, name, baseOpts.recalibrateMode) : getHist<TH1>(Form("h1d%s", name));
602602
}
603603

604604
template <typename TCCDB, typename TBCs>
@@ -691,15 +691,15 @@ struct BuilderModule {
691691
const double nFT0M = nFT0A + nFT0C;
692692
const double nFDDM = nFDDA + nFDDC;
693693

694-
auto populateTable = [&](auto& table, TH1D* h1dMultCalib, TH2D* h2dCentCalib, double multiplicity, auto tableIndex) {
694+
auto populateTable = [&](auto& table, TH1* h1dMultCalib, TH2* h2dCentCalib, double multiplicity, auto tableIndex) {
695695
double percentile = 105.0f;
696696
if (baseOpts.mEnabledTables[tableIndex]) {
697697
if (baseOpts.assignCentralityPerCandidate && h2dCentCalib) {
698698
// Sample P(centrality | genMult) for this generated collision: slice h2dCentCalib at the
699699
// y-bin (generated mult |eta|<0.5) matching this collision and draw from that 1-D distribution.
700700
fRandomSampler.SetSeed(computeSamplingSeed(mcCollisionCounter, tableIndex.value));
701701
int yBin = h2dCentCalib->GetYaxis()->FindBin(nGenMultEta05);
702-
std::unique_ptr<TH1D> pdf{h2dCentCalib->ProjectionX(Form("pdfCent_%d", tableIndex.value), yBin, yBin)};
702+
std::unique_ptr<TH1> pdf{h2dCentCalib->ProjectionX(Form("pdfCent_%d", tableIndex.value), yBin, yBin)};
703703
if (pdf->Integral() > 0) {
704704
percentile = pdf->GetRandom(&fRandomSampler);
705705
}

0 commit comments

Comments
 (0)