diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx index 9fb3bed9a13..5282c3146ce 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx @@ -134,10 +134,10 @@ enum EMiscHistograms { eMiscHistograms_N }; -enum EExternalHistograms { +enum EWeightsHistograms { ePhi = 0, ePt, - eExternalHistograms_N + eWeightsHistograms_N }; enum EObservables { @@ -159,7 +159,7 @@ static constexpr std::array MultiplicityTabl "multFT0M", "multNTracksPV"}; -static constexpr std::array WeightsNames = { +static constexpr std::array WeightsNames = { "ePhi", "ePt"}; @@ -187,7 +187,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // *) external root files Configurable cfExternalFileSwitch{"cfExternalFileSwitch", false, "choose to include external root files or not"}; - Configurable cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/m/mei/O2challenge-", "path to external ROOT file which holds all particle weights"}; + Configurable cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/m/mei/thesis-", "path to external ROOT file which holds all particle weights"}; // *) binnings Configurable cfALICECentBinSwitch{"cfALICECentBinSwitch", true, "switch on or off to use ALICE default binning"}; @@ -219,6 +219,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // *) misc Configurable sigmaInel{"sigmaInel", 7.71, "inelastic cross section in mb"}; Configurable qualityAssuranceSwitch{"qualityAssuranceSwitch", false, "quality assurance switch"}; + Configurable runMessageSwitch{"runMessageSwitch", false, "run message switch"}; // *) Define and initialize all data members to be called in the main process* functions: // **) Task configuration: @@ -247,7 +248,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // *) External histograms: struct ExternalHistograms { TList* fExternalHistogramsList = nullptr; - std::array, eExternalHistograms_N> fWeights{}; //! [type][before, after cuts] + std::array, eWeightsHistograms_N> fWeights{}; //! [type][before, after cuts] } ex; struct Observables { @@ -275,7 +276,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } template - void updateQVectorsTable(std::vector>& QVectorsTable, T1 phi, T1 weight = T1(1)) + void updateQVectorsTable(std::vector>& QVectorsTable, T1 const& phi, T1 weight = T1(1)) { const int maxHarmonic = QVectorsTable.size(); const int maxPower = QVectorsTable.empty() ? 0 : QVectorsTable[0].size(); @@ -526,9 +527,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // templates template - float chooseCent(T1 const& collision) + float chooseCent(T1 const& collision, int const& whichEstimator) { - switch (centralityEstimator) { + switch (whichEstimator) { case eFT0C: return static_cast(collision.centFT0C()); case eFT0M: @@ -544,9 +545,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } template - float chooseMult(T1 const& collision) + float chooseMult(T1 const& collision, int const& whichTable) { - switch (multiplicityTables) { + switch (whichTable) { case eMultTPC: return static_cast(collision.multTPC()); case eMultFV0M: @@ -598,8 +599,8 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to if constexpr (rs == eRec || rs == eRecAndSim) { // Fill reconstructed-level event histograms if (rm == eReal) { - auto thisCent = chooseCent(collision); - auto thisRefMult = chooseMult(collision); + auto thisCent = chooseCent(collision, centralityEstimator); + auto thisRefMult = chooseMult(collision, multiplicityTables); int multiplicityRec = static_cast(tracks.size()); if constexpr (cuts == eBefore) { ec.fEventHist[eHistMultiplicity][eRec][eBefore]->Fill(multiplicityRec); @@ -772,10 +773,13 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to void loadWeights(int runNumber) { - for (int i = 0; i < eExternalHistograms_N; ++i) { + for (int i = 0; i < eWeightsHistograms_N; ++i) { for (int j = 0; j < eCuts_N; ++j) { - ex.fWeights[i][j] = - getHistogramWithWeights(cfFileWithWeights.value.c_str(), Form("%d", runNumber), Form("[%s][%s]", WeightsNames[i], CutsNames[j])); + ex.fWeights[i][j] = getHistogramWithWeights(cfFileWithWeights.value.c_str(), Form("%d", runNumber), Form("[%s][%s]", WeightsNames[i], CutsNames[j])); + if (!ex.fWeights[i][j]) { + LOGF(info, "[%s][%s] not found", WeightsNames[i], CutsNames[j]); + continue; + } ex.fExternalHistogramsList->Add(ex.fWeights[i][j]); } } @@ -784,7 +788,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to template void qaFill(T1 const& collision) { - auto thisCent = chooseCent(collision); + auto thisCent = chooseCent(collision, centralityEstimator); if constexpr (rs == eRecAndSim || rs == eSim) { if (!collision.has_mcCollision()) { return; @@ -807,7 +811,10 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to if (tc.fDryRun) { return; } - int thisRunNumber = collision.bc().runNumber(); + const int thisRunNumber = collision.bc().runNumber(); + if (runMessageSwitch) { + LOGF(info, "Successfully running, run number is %d", thisRunNumber); + } if (isFirstCollision) { // Get run number @@ -848,27 +855,30 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to auto track = tracks.iteratorAt(0); // set the type and scope from one instance for (int64_t i = 0; i < tracks.size(); i++) { track = tracks.iteratorAt(i); - const float thisPhi = track.phi(); - const float thisPt = track.pt(); - float wPhiBefore = 1.f; - float wPhiAfter = 1.f; - float wPtBefore = 1.f; - float wPtAfter = 1.f; - if (cfExternalFileSwitch && ex.fWeights[ePhi][eBefore]) { - wPhiBefore = ex.fWeights[ePhi][eBefore]->GetBinContent(ex.fWeights[ePhi][eBefore]->FindBin(thisPhi)); - wPhiAfter = ex.fWeights[ePhi][eAfter]->GetBinContent(ex.fWeights[ePhi][eAfter]->FindBin(thisPhi)); - wPtBefore = ex.fWeights[ePt][eBefore]->GetBinContent(ex.fWeights[ePt][eBefore]->FindBin(thisPt)); - wPtAfter = ex.fWeights[ePt][eAfter]->GetBinContent(ex.fWeights[ePt][eAfter]->FindBin(thisPt)); + float thisPhi = track.phi(); + float thisPt = track.pt(); + std::array thisPhiAndPt = {thisPhi, thisPt}; + std::array, 2> thisWeights = {{{1.f, 1.f}, {1.f, 1.f}}}; // {{wPhiBefore, wPhiAfter},{wPtBefore, wPtAfter}} + + // eWeightsHistograms_N + if (cfExternalFileSwitch) { + for (int k = 0; k < eWeightsHistograms_N; ++k) { + for (int j = 0; j < eCuts_N; ++j) { + if (ex.fWeights[k][j]) { + thisWeights[k][j] = ex.fWeights[k][j]->GetBinContent(ex.fWeights[k][j]->FindBin(thisPhiAndPt[k])); + } + } + } } particleHistFill(track); particleHistFill(track); - updateQVectorsTable(qVectorsTableBeforeCutsReal, thisPhi, wPhiBefore * wPtBefore); + updateQVectorsTable(qVectorsTableBeforeCutsReal, thisPhi, thisWeights[ePhi][eBefore] * thisWeights[ePt][eBefore]); if (cfMasterCutSwitch) { if (passesEventCutsReal && particleCuts(track)) { particleHistFill(track); - updateQVectorsTable(qVectorsTableAfterCutsReal, thisPhi, wPhiAfter * wPtAfter); + updateQVectorsTable(qVectorsTableAfterCutsReal, thisPhi, thisWeights[ePhi][eAfter] * thisWeights[ePt][eAfter]); } if (passesEventCutsMC && particleCuts(track)) { particleHistFill(track);