From 0f4a3735a7d260c3eeeafdcf54c2559f8f8e03d6 Mon Sep 17 00:00:00 2001 From: Yuanjun Mei Date: Thu, 24 Sep 2026 19:35:26 +0200 Subject: [PATCH 1/4] Add efficiency corrections and rename and redesign some features --- .../Tasks/multiparticleCorrelationsMei.cxx | 664 ++++++++++-------- 1 file changed, 387 insertions(+), 277 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx index 9e32c7d2a4f..f85e20d179e 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +47,6 @@ #include #include -#include #include #include #include @@ -72,7 +73,8 @@ enum ECentralityEstimator { eFT0C = 0, eFT0M, eFV0A, - eNTPV + eNTPV, + eCentralityEstimator_N }; enum EMultiplicityTables { @@ -80,7 +82,8 @@ enum EMultiplicityTables { eMultFV0M, eMultFT0C, eMultFT0M, - eMultNTracksPV + eMultNTracksPV, + eMultiplicityTables_N }; enum ERecSim { @@ -90,8 +93,9 @@ enum ERecSim { }; enum ECuts { - eNoCuts = 0, - eWithCuts + eBefore = 0, + eAfter, + eCuts_N }; enum ERealMC { @@ -100,9 +104,9 @@ enum ERealMC { }; enum EProcess { - eProcessRec = 0, // Run 3, only reconstructed - eProcessRecSim, // Run 3, both reconstructed and simulated - eProcessSim, // Run 3, only simulated + eProcessRec = 0, + eProcessRecSim, + eProcessSim, eProcess_N }; @@ -124,8 +128,16 @@ enum EEventHistograms { eEventHistograms_N }; +enum EPhiAndPtHistograms { + ePhiRec = 0, + ePtRec, + ePtMC, + ePhiAndPtHistograms_N +}; + enum EExternalHistograms { - eHistWeights = 0, + ePhi = 0, + ePt, eExternalHistograms_N }; @@ -134,9 +146,34 @@ enum EObservables { eObservablesHist_N }; +// *) Lists of names: +static constexpr std::array CentralityEstimatorNames = { + "FT0C", + "FT0M", + "FV0A", + "NTPV"}; + +static constexpr std::array MultiplicityTablesNames = { + "multTPC", + "multFV0M", + "multFT0C", + "multFT0M", + "multNTracksPV"}; + +static constexpr std::array WeightsNames = { + "ePhi", + "ePt"}; + +static constexpr std::array CutsNames = { + "eBefore", + "eAfter"}; + // *) Main task: struct MultiparticleCorrelationsMei // this name is used in lower-case format to name the TDirectoryFile in AnalysisResults.root { + // *) Misc: + bool isFirstCollision = true; // this is used to ensure that weights hist are booked once and only once, otherwiese, a crash + // *) Base TList to hold all output objects: TString sBaseListName = "Default list name"; // yes, I declare it separately, because I need it also later in BailOut() function OutputObj fBaseList{sBaseListName.Data(), @@ -145,6 +182,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // *) CCDB: Service ccdb{}; // support for offline callibration data base, not needed for the time being... + Service pdg{}; // *) Define configurables: Configurable centralityEstimator{"centralityEstimator", 0, "centrality estimator: 0=FT0C, 1=FT0M, 2=FV0A, 3=NTPV"}; @@ -156,9 +194,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to Configurable cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/m/mei/O2challenge-", "path to external ROOT file which holds all particle weights"}; // *) binnings - Configurable> cfPtBins{"cfPtBins", {2000, 0., 5.}, "nPtBins, ptMin, ptMax"}; // example for an array - Configurable> cfPhiBins{"cfPhiBins", {180, 0., math::TwoPI}, "nPhiBins, phiMin, phiMax"}; // example for an array - Configurable> cfEtaBins{"cfEtaBins", {800, -3., 3.}, "nEtaBins, etaMin, etaMax"}; // example for an array + Configurable> cfPtBins{"cfPtBins", {2000, 0., 5.}, "nPtBins, ptMin, ptMax"}; + Configurable> cfPhiBins{"cfPhiBins", {180, 0., math::TwoPI}, "nPhiBins, phiMin, phiMax"}; + Configurable> cfEtaBins{"cfEtaBins", {800, -3., 3.}, "nEtaBins, etaMin, etaMax"}; Configurable> cfMultBinsRec{"cfMultBinsRec", {400, 0., 40000.}, "nMultBins, multMin, multMax"}; Configurable> cfMultBinsRef{"cfMultBinsRef", {400, 0., 40000.}, "nMultBins, multMin, multMax"}; @@ -180,6 +218,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to Configurable> cfPtCutRange{"cfPtCutRange", {0.2, 5.}, "pt cut range: {min, max}, with convention: min <= pt < max"}; Configurable cfEtaCutSwitch{"cfEtaCutSwitch", true, "switch to apply pt cut"}; Configurable> cfEtaCutRange{"cfEtaCutRange", {-0.8, 0.8}, "eta cut range: {min, max}, with convention: min <= eta < max"}; + Configurable cfChargeCutSwitch{"cfChargeCutSwitch", true, "switch to apply charge cut (cut neutral particle out)"}; // *) misc Configurable sigmaInel{"sigmaInel", 7.71, "inelastic cross section in mb"}; @@ -196,18 +235,23 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to struct ParticleHistograms { TList* fParticleHistogramsList = nullptr; //!, 2>, eParticleHistograms_N> fParticleHistograms{}; - } pc; // you have to prepend "pc." for all objects name in this group later in the code + } pc; // *) Event histograms: struct EventHistograms { - TList* fEventHistogramsList = nullptr; //!, 2>, eEventHistograms_N> fEventHistograms{}; //! [ type - see enum EEventHistograms ][reco,sim][before, after event cuts] - } ec; // prepend "ec." for event counters + } ec; + + struct PhiAndPtHistograms { + TList* fPhiAndPtHistogramsList = nullptr; + std::array, ePhiAndPtHistograms_N> fPhiAndPtHistograms{}; //! [type][before, after cuts] + } pph; // *) External histograms: struct ExternalHistograms { TList* fExternalHistogramsList = nullptr; - TH1D* fhistWeights = nullptr; + std::array, eExternalHistograms_N> fWeights{}; //! [type][before, after cuts] } ex; struct Observables { @@ -219,7 +263,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to struct QualityAssurance { TList* fQualityAssuranceList = nullptr; //!Get("hist-name"). - // Usage: TH1D *hist = (TH1D*) getObjectFromList("some-valid-TList-pointer","some-object-name"); + // Usage: TH1F *hist = (TH1F*) getObjectFromList("some-valid-TList-pointer","some-object-name"); // Insanity checks: if (!list) { @@ -372,10 +416,10 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to return nullptr; } // TObject* getObjectFromList(TList *list, char *objectName) - TH1D* getHistogramWithWeights(const char* filePath, const char* runNumber) + TH1F* getHistogramWithWeights(const char* filePath, const char* runNumber, const char* histName) { // *) Return value: - TH1D* hist = nullptr; + TH1F* hist = nullptr; TList* baseList = nullptr; // base top-level list in the TFile, e.g. named "ccdb_object" TList* listWithRuns = nullptr; // nested list with run-wise TList's holding run-specific weights @@ -406,7 +450,6 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } weightsFile->GetObject("ccdb_object", baseList); if (!baseList) { - // weightsFile->ls(); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } @@ -428,7 +471,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // File you want to access is in your home dir in CCDB: // Remember that here I do not access the file; instead, I directly access the object in that file. // My home dir in CCDB: https://alice-ccdb.cern.ch/browse/Users/a/abilandz/ => adapt for your case - ccdb->setURL("https://alice-ccdb.cern.ch"); // to be able to use "ccdb" this object in your analysis task, see 4b/ below + ccdb->setURL("https://alice-ccdb.cern.ch"); baseList = dynamic_cast(ccdb->get(TString(filePath).ReplaceAll("/alice-ccdb.cern.ch/", "").Data())); if (!baseList) { LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); @@ -457,13 +500,10 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to TFile* weightsFile = TFile::Open(filePath, "READ"); if (!weightsFile) { - LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); + LOGF(fatal, "\033[1;31m%s at line %d\033[0m can't open file", __FUNCTION__, __LINE__); } - weightsFile->GetObject("ccdb_object", baseList); - if (!baseList) { - // weightsFile->ls(); LOGF(fatal, "\033[1;31m%s at line %d\033[0m", __FUNCTION__, __LINE__); } @@ -480,28 +520,64 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } // Here comes the common code for all three cases, where from "listWithRuns" you fetch the desired histogram with efficiency corrections: - // listWithRuns->ls(); - if (!listWithRuns) { LOGF(fatal, "\033[1;31m%s: listWithRuns is null for run %s\033[0m", __FUNCTION__, runNumber); } - hist = dynamic_cast(listWithRuns->FindObject("h_invert")); + hist = dynamic_cast(listWithRuns->FindObject(histName)); if (!hist) { LOGF(fatal, "%s: histogram 'hist1' not found in run list", __FUNCTION__); } hist->SetDirectory(nullptr); - auto histClone = dynamic_cast(hist->Clone()); + auto histClone = dynamic_cast(hist->Clone()); histClone->SetDirectory(nullptr); - delete baseList; // release back the memory + delete baseList; return histClone; } // templates + template + float chooseCent(T1 const& collision) + { + switch (centralityEstimator) { + case eFT0C: + return static_cast(collision.centFT0C()); + case eFT0M: + return static_cast(collision.centFT0M()); + case eFV0A: + return static_cast(collision.centFV0A()); + case eNTPV: + return static_cast(collision.centNTPV()); + default: + LOG(warning) << "Unknown centrality estimator. Using FT0C as default."; + return static_cast(collision.centFT0C()); + } + } + + template + float chooseMult(T1 const& collision) + { + switch (multiplicityTables) { + case eMultTPC: + return static_cast(collision.multTPC()); + case eMultFV0M: + return static_cast(collision.multFV0M()); + case eMultFT0C: + return static_cast(collision.multFT0C()); + case eMultFT0M: + return static_cast(collision.multFT0M()); + case eMultNTracksPV: + return static_cast(collision.multNTracksPV()); + default: + LOG(warning) << "Unknown multiplicity. Using multTPC as default."; + return static_cast(collision.multTPC()); + } + } + template bool eventCuts(T1 const& collision) { @@ -534,72 +610,28 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to template void eventHistFill(T1 const& collision, T2 const& tracks) { - auto thisCent = collision.centFT0C(); // use auto to determine the type - switch (centralityEstimator) { - case eFT0C: - thisCent = collision.centFT0C(); - break; - case eFT0M: - thisCent = collision.centFT0M(); - break; - case eFV0A: - thisCent = collision.centFV0A(); - break; - case eNTPV: - thisCent = collision.centNTPV(); - break; - default: - LOG(warning) << "Unknown centrality estimator. Using FT0C as default."; - break; // thisCent is already FT0C - } - - LOGF(info, - "centFT0C=%.6f centFT0M=%.6f centFV0A=%.6f", - collision.centFT0C(), - collision.centFT0M(), - collision.centFV0A()); - - auto thisRefMult = collision.multTPC(); // use auto to determine the type - switch (multiplicityTables) { - case eMultTPC: - thisRefMult = collision.multTPC(); - break; - case eMultFV0M: - thisRefMult = collision.multFV0M(); - break; - case eMultFT0C: - thisRefMult = collision.multFT0C(); - break; - case eMultFT0M: - thisRefMult = collision.multFT0M(); - break; - case eMultNTracksPV: - thisRefMult = collision.multNTracksPV(); - break; - default: - LOG(warning) << "Unknown multiplicity. Using multTPC as default."; - break; // thisRefMult is already multTPC - } + auto thisCent = chooseCent(collision); + auto thisRefMult = chooseMult(collision); if constexpr (rs == eRec || rs == eRecAndSim) { // Fill reconstructed-level event histograms if (rm == eReal) { int multiplicityRec = static_cast(tracks.size()); - if constexpr (cuts == eNoCuts) { - ec.fEventHistograms[eHistMultiplicity][eRec][eNoCuts]->Fill(multiplicityRec); - ec.fEventHistograms[eHistCentrality][eRec][eNoCuts]->Fill(thisCent); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eNoCuts]->Fill(thisRefMult); - ec.fEventHistograms[eHistVertexX][eRec][eNoCuts]->Fill(collision.posX()); - ec.fEventHistograms[eHistVertexY][eRec][eNoCuts]->Fill(collision.posY()); - ec.fEventHistograms[eHistVertexZ][eRec][eNoCuts]->Fill(collision.posZ()); + if constexpr (cuts == eBefore) { + ec.fEventHistograms[eHistMultiplicity][eRec][eBefore]->Fill(multiplicityRec); + ec.fEventHistograms[eHistCentrality][eRec][eBefore]->Fill(thisCent); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore]->Fill(thisRefMult); + ec.fEventHistograms[eHistVertexX][eRec][eBefore]->Fill(collision.posX()); + ec.fEventHistograms[eHistVertexY][eRec][eBefore]->Fill(collision.posY()); + ec.fEventHistograms[eHistVertexZ][eRec][eBefore]->Fill(collision.posZ()); } - if constexpr (cuts == eWithCuts) { - ec.fEventHistograms[eHistMultiplicity][eRec][eWithCuts]->Fill(multiplicityRec); - ec.fEventHistograms[eHistCentrality][eRec][eWithCuts]->Fill(thisCent); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eWithCuts]->Fill(thisRefMult); - ec.fEventHistograms[eHistVertexX][eRec][eWithCuts]->Fill(collision.posX()); - ec.fEventHistograms[eHistVertexY][eRec][eWithCuts]->Fill(collision.posY()); - ec.fEventHistograms[eHistVertexZ][eRec][eWithCuts]->Fill(collision.posZ()); + if constexpr (cuts == eAfter) { + ec.fEventHistograms[eHistMultiplicity][eRec][eAfter]->Fill(multiplicityRec); + ec.fEventHistograms[eHistCentrality][eRec][eAfter]->Fill(thisCent); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter]->Fill(thisRefMult); + ec.fEventHistograms[eHistVertexX][eRec][eAfter]->Fill(collision.posX()); + ec.fEventHistograms[eHistVertexY][eRec][eAfter]->Fill(collision.posY()); + ec.fEventHistograms[eHistVertexZ][eRec][eAfter]->Fill(collision.posZ()); } } @@ -613,28 +645,23 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to auto thisMCCollision = collision.mcCollision(); // corresponding MC truth simulated particle int multiplicitySim = static_cast(tracks.size()); auto impactParameter = thisMCCollision.impactParameter(); - LOGF(info, - "Reco collision = %d, MC collision = %d, b = %f", - collision.globalIndex(), - thisMCCollision.globalIndex(), - impactParameter); auto centralityMC = math::PI * impactParameter * impactParameter / sigmaInel; // centrality for sim derived from impact parameter - if constexpr (cuts == eNoCuts) { - ec.fEventHistograms[eHistMultiplicity][eSim][eNoCuts]->Fill(multiplicitySim); - ec.fEventHistograms[eHistCentrality][eSim][eNoCuts]->Fill(centralityMC); - ec.fEventHistograms[eHistImpactParameter][eSim][eNoCuts]->Fill(impactParameter); - ec.fEventHistograms[eHistVertexX][eSim][eNoCuts]->Fill(thisMCCollision.posX()); - ec.fEventHistograms[eHistVertexY][eSim][eNoCuts]->Fill(thisMCCollision.posY()); - ec.fEventHistograms[eHistVertexZ][eSim][eNoCuts]->Fill(thisMCCollision.posZ()); + if constexpr (cuts == eBefore) { + ec.fEventHistograms[eHistMultiplicity][eSim][eBefore]->Fill(multiplicitySim); + ec.fEventHistograms[eHistCentrality][eSim][eBefore]->Fill(centralityMC); + ec.fEventHistograms[eHistImpactParameter][eSim][eBefore]->Fill(impactParameter); + ec.fEventHistograms[eHistVertexX][eSim][eBefore]->Fill(thisMCCollision.posX()); + ec.fEventHistograms[eHistVertexY][eSim][eBefore]->Fill(thisMCCollision.posY()); + ec.fEventHistograms[eHistVertexZ][eSim][eBefore]->Fill(thisMCCollision.posZ()); } - if constexpr (cuts == eWithCuts) { - ec.fEventHistograms[eHistMultiplicity][eSim][eWithCuts]->Fill(multiplicitySim); - ec.fEventHistograms[eHistCentrality][eSim][eWithCuts]->Fill(centralityMC); - ec.fEventHistograms[eHistImpactParameter][eSim][eWithCuts]->Fill(impactParameter); - ec.fEventHistograms[eHistVertexX][eSim][eWithCuts]->Fill(thisMCCollision.posX()); - ec.fEventHistograms[eHistVertexY][eSim][eWithCuts]->Fill(thisMCCollision.posY()); - ec.fEventHistograms[eHistVertexZ][eSim][eWithCuts]->Fill(thisMCCollision.posZ()); + if constexpr (cuts == eAfter) { + ec.fEventHistograms[eHistMultiplicity][eSim][eAfter]->Fill(multiplicitySim); + ec.fEventHistograms[eHistCentrality][eSim][eAfter]->Fill(centralityMC); + ec.fEventHistograms[eHistImpactParameter][eSim][eAfter]->Fill(impactParameter); + ec.fEventHistograms[eHistVertexX][eSim][eAfter]->Fill(thisMCCollision.posX()); + ec.fEventHistograms[eHistVertexY][eSim][eAfter]->Fill(thisMCCollision.posY()); + ec.fEventHistograms[eHistVertexZ][eSim][eAfter]->Fill(thisMCCollision.posZ()); } } // end of if (rm == eMC) { } @@ -644,7 +671,6 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to template bool particleCuts(T const& track) { - // add eta cuts!!!!!! if constexpr (rs == eRec || rs == eRecAndSim) { if (cfPtCutSwitch) // pt cuts for Rec { @@ -686,6 +712,27 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } // end of if (rm == eMC) { } } + if (cfChargeCutSwitch) // charge cuts for Rec + { + if (rm == eReal) { + if (track.sign() == 0) { + return false; + } + } + if constexpr (rs == eRecAndSim) // charge cuts for Sim + { + if (rm == eMC) { + if (!track.has_mcParticle()) { + return false; + } + auto mcParticle = track.mcParticle(); + auto chargeMC = pdg->GetParticle(mcParticle.pdgCode())->Charge(); + if (chargeMC == 0) { + return false; + } + } // end of if (rm == eMC) { + } + } } return true; @@ -696,16 +743,16 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to { if constexpr (rs == eRec || rs == eRecAndSim) { if (rm == eReal) { - if constexpr (cuts == eNoCuts) { - pc.fParticleHistograms[eHistPt][eRec][eNoCuts]->Fill(track.pt()); - pc.fParticleHistograms[eHistPhi][eRec][eNoCuts]->Fill(track.phi()); - pc.fParticleHistograms[eHistEta][eRec][eNoCuts]->Fill(track.eta()); + if constexpr (cuts == eBefore) { + pc.fParticleHistograms[eHistPt][eRec][eBefore]->Fill(track.pt()); + pc.fParticleHistograms[eHistPhi][eRec][eBefore]->Fill(track.phi()); + pc.fParticleHistograms[eHistEta][eRec][eBefore]->Fill(track.eta()); } - if constexpr (cuts == eWithCuts) { - pc.fParticleHistograms[eHistPt][eRec][eWithCuts]->Fill(track.pt()); - pc.fParticleHistograms[eHistPhi][eRec][eWithCuts]->Fill(track.phi()); - pc.fParticleHistograms[eHistEta][eRec][eWithCuts]->Fill(track.eta()); + if constexpr (cuts == eAfter) { + pc.fParticleHistograms[eHistPt][eRec][eAfter]->Fill(track.pt()); + pc.fParticleHistograms[eHistPhi][eRec][eAfter]->Fill(track.phi()); + pc.fParticleHistograms[eHistEta][eRec][eAfter]->Fill(track.eta()); } } @@ -713,49 +760,59 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // See https://github.com/AliceO2Group/O2Physics/blob/master/Tutorials/src/mcHistograms.cxx // See https://aliceo2group.github.io/analysis-framework/docs/datamodel/ao2dTables.html#montecarlo if constexpr (rs == eRecAndSim) { + if (rm == eReal) { + if constexpr (cuts == eBefore) { + pph.fPhiAndPtHistograms[ePhiRec][eBefore]->Fill(track.phi()); + pph.fPhiAndPtHistograms[ePtRec][eBefore]->Fill(track.pt()); + } + if constexpr (cuts == eAfter) { + pph.fPhiAndPtHistograms[ePhiRec][eAfter]->Fill(track.phi()); + pph.fPhiAndPtHistograms[ePtRec][eAfter]->Fill(track.pt()); + } + } + if (rm == eMC) { if (!track.has_mcParticle()) { LOGF(warning, " No MC particle for this track, skip..."); return; } - auto mcParticle = track.mcParticle(); // corresponding MC truth simulated particle - if constexpr (cuts == eNoCuts) { - pc.fParticleHistograms[eHistPt][eSim][eNoCuts]->Fill(mcParticle.pt()); - pc.fParticleHistograms[eHistPhi][eSim][eNoCuts]->Fill(mcParticle.phi()); - pc.fParticleHistograms[eHistEta][eSim][eNoCuts]->Fill(mcParticle.eta()); + auto mcParticle = track.mcParticle(); + if constexpr (cuts == eBefore) { + pc.fParticleHistograms[eHistPt][eSim][eBefore]->Fill(mcParticle.pt()); + pc.fParticleHistograms[eHistPhi][eSim][eBefore]->Fill(mcParticle.phi()); + pc.fParticleHistograms[eHistEta][eSim][eBefore]->Fill(mcParticle.eta()); + pph.fPhiAndPtHistograms[ePtMC][eBefore]->Fill(mcParticle.pt()); } - if constexpr (cuts == eWithCuts) { - pc.fParticleHistograms[eHistPt][eSim][eWithCuts]->Fill(mcParticle.pt()); - pc.fParticleHistograms[eHistPhi][eSim][eWithCuts]->Fill(mcParticle.phi()); - pc.fParticleHistograms[eHistEta][eSim][eWithCuts]->Fill(mcParticle.eta()); + if constexpr (cuts == eAfter) { + pc.fParticleHistograms[eHistPt][eSim][eAfter]->Fill(mcParticle.pt()); + pc.fParticleHistograms[eHistPhi][eSim][eAfter]->Fill(mcParticle.phi()); + pc.fParticleHistograms[eHistEta][eSim][eAfter]->Fill(mcParticle.eta()); + pph.fPhiAndPtHistograms[ePtMC][eAfter]->Fill(mcParticle.pt()); } } // end of if (rm == eMC) { } } } + void loadWeights(int runNumber) + { + for (int i = 0; i < eExternalHistograms_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.fExternalHistogramsList->Add(ex.fWeights[i][j]); + } + } + } + template void qaFill(T1 const& collision) { - auto thisCent = collision.centFT0C(); // use auto to determine the type - switch (centralityEstimator) { - case eFT0C: - thisCent = collision.centFT0C(); - break; - case eFT0M: - thisCent = collision.centFT0M(); - break; - case eFV0A: - thisCent = collision.centFV0A(); - break; - case eNTPV: - thisCent = collision.centNTPV(); - break; - default: - LOG(warning) << "Unknown centrality estimator. Using FT0C as default."; - break; // thisCent is already FT0C - } + auto thisCent = chooseCent(collision); if constexpr (rs == eRecAndSim || rs == eSim) { if (!collision.has_mcCollision()) { return; @@ -775,6 +832,22 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to if (tc.fDryRun) { return; } + int thisRunNumber = collision.bc().runNumber(); + + // Set titles for all PhiAndPtHistograms to the runNumber + if (rs == eRecAndSim && isFirstCollision) { + for (int i = 0; i < eCuts_N; ++i) { + for (int j = 0; j < ePhiAndPtHistograms_N; ++j) { + pph.fPhiAndPtHistograms[j][i]->SetTitle(Form("%d", thisRunNumber)); + } + } + } + + // Get weights + if (cfExternalFileSwitch && isFirstCollision) { + loadWeights(thisRunNumber); + } + isFirstCollision = false; // Fill Quality Assurance if (qualityAssuranceSwitch) { @@ -785,64 +858,68 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to const bool passesEventCutsMC = eventCuts(collision); // Fill Event Hist - eventHistFill(collision, tracks); - eventHistFill(collision, tracks); + eventHistFill(collision, tracks); + eventHistFill(collision, tracks); if (cfMasterCutSwitch) { if (passesEventCutsReal) { - eventHistFill(collision, tracks); + eventHistFill(collision, tracks); } if (passesEventCutsMC) { - eventHistFill(collision, tracks); + eventHistFill(collision, tracks); } } // Print current run number: - LOGF(info, "Run number: %d", collision.bc().runNumber()); - - // Print centrality estimated with the selected estimator: - // LOGF(info, "Centrality: %f", thisCent); - + LOGF(info, "Run number: %d", thisRunNumber); // Print vertex X position: LOGF(info, "Vertex X position: %f", collision.posX()); std::vector n2 = {-2, 2}; - auto qVectorsTableNoCutsReal = initQVectorsTable(2, n2); - auto qVectorsTableWithCutsReal = initQVectorsTable(2, n2); + auto qVectorsTableBeforeCutsReal = initQVectorsTable(2, n2); + auto qVectorsTableAfterCutsReal = initQVectorsTable(2, n2); // Main loop over particles: auto track = tracks.iteratorAt(0); // set the type and scope from one instance for (int64_t i = 0; i < tracks.size(); i++) { - // Print track azimuthal angle: - // LOGF(info, "Track azimuthal angle: %f", track.phi()); - 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) { + 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)); + } - particleHistFill(track); - updateQVectorsTable(qVectorsTableNoCutsReal, track.phi()); - - particleHistFill(track); + particleHistFill(track); + particleHistFill(track); + updateQVectorsTable(qVectorsTableBeforeCutsReal, thisPhi, wPhiBefore * wPtBefore); if (cfMasterCutSwitch) { if (passesEventCutsReal && particleCuts(track)) { - particleHistFill(track); - updateQVectorsTable(qVectorsTableWithCutsReal, track.phi()); + particleHistFill(track); + updateQVectorsTable(qVectorsTableAfterCutsReal, thisPhi, wPhiAfter * wPtAfter); } if (passesEventCutsMC && particleCuts(track)) { - particleHistFill(track); + particleHistFill(track); } } } // end of for (int64_t i = 0; i < tracks.size(); i++) { std::vector resultMultCorr(2, TComplex(0., 0.)); - resultMultCorr = two(qVectorsTableNoCutsReal, n2); + resultMultCorr = two(qVectorsTableBeforeCutsReal, n2); if (noneZeroDenom(resultMultCorr)) { - obs.fProfTwo[eRec][eNoCuts]->Fill(0.5, (resultMultCorr[0] / resultMultCorr[1].Re()).Re() / (1e-2)); + obs.fProfTwo[eRec][eBefore]->Fill(0.5, (resultMultCorr[0] / resultMultCorr[1].Re()).Re() / (1e-2)); } if (cfMasterCutSwitch && passesEventCutsReal) { - resultMultCorr = two(qVectorsTableWithCutsReal, n2); + resultMultCorr = two(qVectorsTableAfterCutsReal, n2); if (noneZeroDenom(resultMultCorr)) { - obs.fProfTwo[eRec][eWithCuts]->Fill(0.5, (resultMultCorr[0] / resultMultCorr[1].Re()).Re() / (1e-2)); + obs.fProfTwo[eRec][eAfter]->Fill(0.5, (resultMultCorr[0] / resultMultCorr[1].Re()).Re() / (1e-2)); } } @@ -852,10 +929,10 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to void init(InitContext&) { // ... code to book and initialize all analysis objects ... - const int withCutFillColor = kGreen - 10; - const int withCutLineColor = kGreen; - const int noCutFillColor = kRed - 10; - const int noCutLineColor = kRed; + const int afterCutFillColor = kGreen - 10; + const int afterCutLineColor = kGreen; + const int beforeCutFillColor = kRed - 10; + const int beforeCutLineColor = kRed; // *) Set automatically what to process, from an implicit variable "doprocessSomEProcessName" within a PROCESS_SWITCH clause: tc.fProcess[eProcessRec] = doprocessRec; @@ -877,11 +954,6 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to ex.fExternalHistogramsList->SetName("ExternalHistograms"); ex.fExternalHistogramsList->SetOwner(true); fBaseList->Add(ex.fExternalHistogramsList); - - // *) Book and Fill external hist - ex.fhistWeights = getHistogramWithWeights(cfFileWithWeights.value.c_str(), "000123456"); - ex.fhistWeights->SetTitle(cfFileWithWeights.value.c_str()); - ex.fExternalHistogramsList->Add(ex.fhistWeights); } // *) Book particle TLists: @@ -891,81 +963,81 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to fBaseList->Add(pc.fParticleHistogramsList); // any nested TList in the base TList appears as a subdir in the output ROOT file // *) Book pt and phi distribution with binning defined through configurables in the json file: - std::vector lPtBins = cfPtBins.value; // define local array and initialize it from an array set in the configurables + std::vector lPtBins = cfPtBins.value; int nBinsPt = static_cast(lPtBins[0]); float minPt = lPtBins[1]; float maxPt = lPtBins[2]; - std::vector lPhiBins = cfPhiBins.value; // define local array and initialize it from an array set in the configurables + std::vector lPhiBins = cfPhiBins.value; int nBinsPhi = static_cast(lPhiBins[0]); float minPhi = lPhiBins[1]; float maxPhi = lPhiBins[2]; - std::vector lEtaBins = cfEtaBins.value; // define local array and initialize it from an array set in the configurables + std::vector lEtaBins = cfEtaBins.value; int nBinsEta = static_cast(lEtaBins[0]); float minEta = lEtaBins[1]; float maxEta = lEtaBins[2]; if (doprocessRec || doprocessRecSim) { - pc.fParticleHistograms[eHistPt][eRec][eNoCuts] = new TH1F("[eHistPt][eRec][eNoCuts]", "pt distribution for reconstructed particles before cuts", nBinsPt, minPt, maxPt); - pc.fParticleHistograms[eHistPt][eRec][eNoCuts]->GetXaxis()->SetTitle("p_{T}"); + pc.fParticleHistograms[eHistPt][eRec][eBefore] = new TH1F("[eHistPt][eRec][eBefore]", "pt distribution for reconstructed particles before cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eRec][eBefore]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eRec][eNoCuts] = new TH1F("[eHistPhi][eRec][eNoCuts]", "phi distribution for reconstructed particles before cuts", nBinsPhi, minPhi, maxPhi); - pc.fParticleHistograms[eHistPhi][eRec][eNoCuts]->GetXaxis()->SetTitle("#varphi"); + pc.fParticleHistograms[eHistPhi][eRec][eBefore] = new TH1F("[eHistPhi][eRec][eBefore]", "phi distribution for reconstructed particles before cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eRec][eBefore]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eRec][eNoCuts] = new TH1F("[eHistEta][eRec][eNoCuts]", "eta distribution for reconstructed particles before cuts", nBinsEta, minEta, maxEta); - pc.fParticleHistograms[eHistEta][eRec][eNoCuts]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistEta][eRec][eBefore] = new TH1F("[eHistEta][eRec][eBefore]", "eta distribution for reconstructed particles before cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eRec][eBefore]->GetXaxis()->SetTitle("#eta"); for (int i = 0; i < eParticleHistograms_N; ++i) { - pc.fParticleHistograms[i][eRec][eNoCuts]->SetColors(noCutLineColor, -1, noCutFillColor); - pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eNoCuts]); + pc.fParticleHistograms[i][eRec][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); + pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eBefore]); } if (cfMasterCutSwitch) { - pc.fParticleHistograms[eHistPt][eRec][eWithCuts] = new TH1F("[eHistPt][eRec][eWithCuts]", "pt distribution for reconstructed particles after cuts", nBinsPt, minPt, maxPt); - pc.fParticleHistograms[eHistPt][eRec][eWithCuts]->GetXaxis()->SetTitle("p_{T}"); + pc.fParticleHistograms[eHistPt][eRec][eAfter] = new TH1F("[eHistPt][eRec][eAfter]", "pt distribution for reconstructed particles after cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eRec][eAfter]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eRec][eWithCuts] = new TH1F("[eHistPhi][eRec][eWithCuts]", "phi distribution for reconstructed particles after cuts", nBinsPhi, minPhi, maxPhi); - pc.fParticleHistograms[eHistPhi][eRec][eWithCuts]->GetXaxis()->SetTitle("#varphi"); + pc.fParticleHistograms[eHistPhi][eRec][eAfter] = new TH1F("[eHistPhi][eRec][eAfter]", "phi distribution for reconstructed particles after cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eRec][eAfter]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eRec][eWithCuts] = new TH1F("[eHistEta][eRec][eWithCuts]", "eta distribution for reconstructed particles after cuts", nBinsEta, minEta, maxEta); - pc.fParticleHistograms[eHistEta][eRec][eWithCuts]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistEta][eRec][eAfter] = new TH1F("[eHistEta][eRec][eAfter]", "eta distribution for reconstructed particles after cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eRec][eAfter]->GetXaxis()->SetTitle("#eta"); for (int i = 0; i < eParticleHistograms_N; ++i) { - pc.fParticleHistograms[i][eRec][eWithCuts]->SetColors(withCutLineColor, -1, withCutFillColor); - pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eWithCuts]); + pc.fParticleHistograms[i][eRec][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); + pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eAfter]); } } } if (doprocessSim || doprocessRecSim) { - pc.fParticleHistograms[eHistPt][eSim][eNoCuts] = new TH1F("[eHistPt][eSim][eNoCuts]", "pt distribution for simulated particles before cuts", nBinsPt, minPt, maxPt); - pc.fParticleHistograms[eHistPt][eSim][eNoCuts]->GetXaxis()->SetTitle("p_{T}"); + pc.fParticleHistograms[eHistPt][eSim][eBefore] = new TH1F("[eHistPt][eSim][eBefore]", "pt distribution for simulated particles before cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eSim][eBefore]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eSim][eNoCuts] = new TH1F("[eHistPhi][eSim][eNoCuts]", "phi distribution for simulated particles before cuts", nBinsPhi, minPhi, maxPhi); - pc.fParticleHistograms[eHistPhi][eSim][eNoCuts]->GetXaxis()->SetTitle("#varphi"); + pc.fParticleHistograms[eHistPhi][eSim][eBefore] = new TH1F("[eHistPhi][eSim][eBefore]", "phi distribution for simulated particles before cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eSim][eBefore]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eSim][eNoCuts] = new TH1F("[eHistEta][eSim][eNoCuts]", "eta distribution for simulated particles before cuts", nBinsEta, minEta, maxEta); - pc.fParticleHistograms[eHistEta][eSim][eNoCuts]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistEta][eSim][eBefore] = new TH1F("[eHistEta][eSim][eBefore]", "eta distribution for simulated particles before cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eSim][eBefore]->GetXaxis()->SetTitle("#eta"); for (int i = 0; i < eParticleHistograms_N; ++i) { - pc.fParticleHistograms[i][eSim][eNoCuts]->SetColors(noCutLineColor, -1, noCutFillColor); - pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eNoCuts]); + pc.fParticleHistograms[i][eSim][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); + pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eBefore]); } if (cfMasterCutSwitch) { - pc.fParticleHistograms[eHistPt][eSim][eWithCuts] = new TH1F("[eHistPt][eSim][eWithCuts]", "pt distribution for simulated particles after cuts", nBinsPt, minPt, maxPt); - pc.fParticleHistograms[eHistPt][eSim][eWithCuts]->GetXaxis()->SetTitle("p_{T}"); + pc.fParticleHistograms[eHistPt][eSim][eAfter] = new TH1F("[eHistPt][eSim][eAfter]", "pt distribution for simulated particles after cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eSim][eAfter]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eSim][eWithCuts] = new TH1F("[eHistPhi][eSim][eWithCuts]", "phi distribution for simulated particles after cuts", nBinsPhi, minPhi, maxPhi); - pc.fParticleHistograms[eHistPhi][eSim][eWithCuts]->GetXaxis()->SetTitle("#varphi"); + pc.fParticleHistograms[eHistPhi][eSim][eAfter] = new TH1F("[eHistPhi][eSim][eAfter]", "phi distribution for simulated particles after cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eSim][eAfter]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eSim][eWithCuts] = new TH1F("[eHistEta][eSim][eWithCuts]", "eta distribution for simulated particles after cuts", nBinsEta, minEta, maxEta); - pc.fParticleHistograms[eHistEta][eSim][eWithCuts]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistEta][eSim][eAfter] = new TH1F("[eHistEta][eSim][eAfter]", "eta distribution for simulated particles after cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eSim][eAfter]->GetXaxis()->SetTitle("#eta"); for (int i = 0; i < eParticleHistograms_N; ++i) { - pc.fParticleHistograms[i][eSim][eWithCuts]->SetColors(withCutLineColor, -1, withCutFillColor); - pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eWithCuts]); + pc.fParticleHistograms[i][eSim][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); + pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eAfter]); } } } @@ -1019,108 +1091,108 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // eEventHistograms_N if (doprocessRec || doprocessRecSim) { - ec.fEventHistograms[eHistCentrality][eRec][eNoCuts] = new TH1F("[eHistCentrality][eRec][eNoCuts]", "Centrality (reconstructed) before cuts", nBinsCent, minCent, maxCent); - ec.fEventHistograms[eHistCentrality][eRec][eNoCuts]->GetXaxis()->SetTitle("Centrality"); + ec.fEventHistograms[eHistCentrality][eRec][eBefore] = new TH1F("[eHistCentrality][eRec][eBefore]", "Centrality (reconstructed) before cuts", nBinsCent, minCent, maxCent); + ec.fEventHistograms[eHistCentrality][eRec][eBefore]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eRec][eNoCuts] = new TH1F("[eHistMultiplicity][eRec][eNoCuts]", "Multiplicity (reconstructed) before cuts", nBinsMultRec, minMultRec, maxMultRec); - ec.fEventHistograms[eHistMultiplicity][eRec][eNoCuts]->GetXaxis()->SetTitle("Multiplicity"); + ec.fEventHistograms[eHistMultiplicity][eRec][eBefore] = new TH1F("[eHistMultiplicity][eRec][eBefore]", "Multiplicity (reconstructed) before cuts", nBinsMultRec, minMultRec, maxMultRec); + ec.fEventHistograms[eHistMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eNoCuts] = new TH1F("[eHistReferenceMultiplicity][eRec][eNoCuts]", "Reference Multiplicity before cuts", nBinsMultRef, minMultRef, maxMultRef); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eNoCuts]->GetXaxis()->SetTitle("Reference Multiplicity"); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore] = new TH1F("[eHistReferenceMultiplicity][eRec][eBefore]", "Reference Multiplicity before cuts", nBinsMultRef, minMultRef, maxMultRef); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle("Reference Multiplicity"); - ec.fEventHistograms[eHistVertexX][eRec][eNoCuts] = new TH1F("[eHistVertexX][eRec][eNoCuts]", "Vertex X (reconstructed) before cuts", nBinsVx, minVx, maxVx); - ec.fEventHistograms[eHistVertexX][eRec][eNoCuts]->GetXaxis()->SetTitle("Vertex X"); + ec.fEventHistograms[eHistVertexX][eRec][eBefore] = new TH1F("[eHistVertexX][eRec][eBefore]", "Vertex X (reconstructed) before cuts", nBinsVx, minVx, maxVx); + ec.fEventHistograms[eHistVertexX][eRec][eBefore]->GetXaxis()->SetTitle("Vertex X"); - ec.fEventHistograms[eHistVertexY][eRec][eNoCuts] = new TH1F("[eHistVertexY][eRec][eNoCuts]", "Vertex Y (reconstructed) before cuts", nBinsVy, minVy, maxVy); - ec.fEventHistograms[eHistVertexY][eRec][eNoCuts]->GetXaxis()->SetTitle("Vertex Y"); + ec.fEventHistograms[eHistVertexY][eRec][eBefore] = new TH1F("[eHistVertexY][eRec][eBefore]", "Vertex Y (reconstructed) before cuts", nBinsVy, minVy, maxVy); + ec.fEventHistograms[eHistVertexY][eRec][eBefore]->GetXaxis()->SetTitle("Vertex Y"); - ec.fEventHistograms[eHistVertexZ][eRec][eNoCuts] = new TH1F("[eHistVertexZ][eRec][eNoCuts]", "Vertex Z (reconstructed) before cuts", nBinsVz, minVz, maxVz); - ec.fEventHistograms[eHistVertexZ][eRec][eNoCuts]->GetXaxis()->SetTitle("Vertex Z"); + ec.fEventHistograms[eHistVertexZ][eRec][eBefore] = new TH1F("[eHistVertexZ][eRec][eBefore]", "Vertex Z (reconstructed) before cuts", nBinsVz, minVz, maxVz); + ec.fEventHistograms[eHistVertexZ][eRec][eBefore]->GetXaxis()->SetTitle("Vertex Z"); for (int i = 0; i < eEventHistograms_N; ++i) { if (i != eHistImpactParameter) { - ec.fEventHistograms[i][eRec][eNoCuts]->SetColors(noCutLineColor, -1, noCutFillColor); - ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eRec][eNoCuts]); + ec.fEventHistograms[i][eRec][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); + ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eRec][eBefore]); } } if (cfMasterCutSwitch) { - ec.fEventHistograms[eHistCentrality][eRec][eWithCuts] = new TH1F("[eHistCentrality][eRec][eWithCuts]", "Centrality (reconstructed) after cuts", nBinsCent, minCent, maxCent); - ec.fEventHistograms[eHistCentrality][eRec][eWithCuts]->GetXaxis()->SetTitle("Centrality"); + ec.fEventHistograms[eHistCentrality][eRec][eAfter] = new TH1F("[eHistCentrality][eRec][eAfter]", "Centrality (reconstructed) after cuts", nBinsCent, minCent, maxCent); + ec.fEventHistograms[eHistCentrality][eRec][eAfter]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eRec][eWithCuts] = new TH1F("[eHistMultiplicity][eRec][eWithCuts]", "Multiplicity (reconstructed) after cuts", nBinsMultRec, minMultRec, maxMultRec); - ec.fEventHistograms[eHistMultiplicity][eRec][eWithCuts]->GetXaxis()->SetTitle("Multiplicity"); + ec.fEventHistograms[eHistMultiplicity][eRec][eAfter] = new TH1F("[eHistMultiplicity][eRec][eAfter]", "Multiplicity (reconstructed) after cuts", nBinsMultRec, minMultRec, maxMultRec); + ec.fEventHistograms[eHistMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eWithCuts] = new TH1F("[eHistReferenceMultiplicity][eRec][eWithCuts]", "Reference Multiplicity after cuts", nBinsMultRef, minMultRef, maxMultRef); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eWithCuts]->GetXaxis()->SetTitle("Reference Multiplicity"); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter] = new TH1F("[eHistReferenceMultiplicity][eRec][eAfter]", "Reference Multiplicity after cuts", nBinsMultRef, minMultRef, maxMultRef); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle("Reference Multiplicity"); - ec.fEventHistograms[eHistVertexX][eRec][eWithCuts] = new TH1F("[eHistVertexX][eRec][eWithCuts]", "Vertex X (reconstructed) after cuts", nBinsVx, minVx, maxVx); - ec.fEventHistograms[eHistVertexX][eRec][eWithCuts]->GetXaxis()->SetTitle("Vertex X"); + ec.fEventHistograms[eHistVertexX][eRec][eAfter] = new TH1F("[eHistVertexX][eRec][eAfter]", "Vertex X (reconstructed) after cuts", nBinsVx, minVx, maxVx); + ec.fEventHistograms[eHistVertexX][eRec][eAfter]->GetXaxis()->SetTitle("Vertex X"); - ec.fEventHistograms[eHistVertexY][eRec][eWithCuts] = new TH1F("[eHistVertexY][eRec][eWithCuts]", "Vertex Y (reconstructed) after cuts", nBinsVy, minVy, maxVy); - ec.fEventHistograms[eHistVertexY][eRec][eWithCuts]->GetXaxis()->SetTitle("Vertex Y"); + ec.fEventHistograms[eHistVertexY][eRec][eAfter] = new TH1F("[eHistVertexY][eRec][eAfter]", "Vertex Y (reconstructed) after cuts", nBinsVy, minVy, maxVy); + ec.fEventHistograms[eHistVertexY][eRec][eAfter]->GetXaxis()->SetTitle("Vertex Y"); - ec.fEventHistograms[eHistVertexZ][eRec][eWithCuts] = new TH1F("[eHistVertexZ][eRec][eWithCuts]", "Vertex Z (reconstructed) after cuts", nBinsVz, minVz, maxVz); - ec.fEventHistograms[eHistVertexZ][eRec][eWithCuts]->GetXaxis()->SetTitle("Vertex Z"); + ec.fEventHistograms[eHistVertexZ][eRec][eAfter] = new TH1F("[eHistVertexZ][eRec][eAfter]", "Vertex Z (reconstructed) after cuts", nBinsVz, minVz, maxVz); + ec.fEventHistograms[eHistVertexZ][eRec][eAfter]->GetXaxis()->SetTitle("Vertex Z"); for (int i = 0; i < eEventHistograms_N; ++i) { if (i != eHistImpactParameter) { - ec.fEventHistograms[i][eRec][eWithCuts]->SetColors(withCutLineColor, -1, withCutFillColor); - ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eRec][eWithCuts]); + ec.fEventHistograms[i][eRec][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); + ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eRec][eAfter]); } } } } if (doprocessSim || doprocessRecSim) { - ec.fEventHistograms[eHistCentrality][eSim][eNoCuts] = new TH1F("[eHistCentrality][eSim][eNoCuts]", "Centrality (simulated) before cuts", nBinsCent, minCent, maxCent); - ec.fEventHistograms[eHistCentrality][eSim][eNoCuts]->GetXaxis()->SetTitle("Centrality"); + ec.fEventHistograms[eHistCentrality][eSim][eBefore] = new TH1F("[eHistCentrality][eSim][eBefore]", "Centrality (simulated) before cuts", nBinsCent, minCent, maxCent); + ec.fEventHistograms[eHistCentrality][eSim][eBefore]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eSim][eNoCuts] = new TH1F("[eHistMultiplicity][eSim][eNoCuts]", "Multiplicity (simulated) before cuts", nBinsMultSim, minMultSim, maxMultSim); - ec.fEventHistograms[eHistMultiplicity][eSim][eNoCuts]->GetXaxis()->SetTitle("Multiplicity"); + ec.fEventHistograms[eHistMultiplicity][eSim][eBefore] = new TH1F("[eHistMultiplicity][eSim][eBefore]", "Multiplicity (simulated) before cuts", nBinsMultSim, minMultSim, maxMultSim); + ec.fEventHistograms[eHistMultiplicity][eSim][eBefore]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); - ec.fEventHistograms[eHistVertexX][eSim][eNoCuts] = new TH1F("[eHistVertexX][eSim][eNoCuts]", "Vertex X (simulated) before cuts", nBinsVx, minVx, maxVx); - ec.fEventHistograms[eHistVertexX][eSim][eNoCuts]->GetXaxis()->SetTitle("Vertex X"); + ec.fEventHistograms[eHistVertexX][eSim][eBefore] = new TH1F("[eHistVertexX][eSim][eBefore]", "Vertex X (simulated) before cuts", nBinsVx, minVx, maxVx); + ec.fEventHistograms[eHistVertexX][eSim][eBefore]->GetXaxis()->SetTitle("Vertex X"); - ec.fEventHistograms[eHistVertexY][eSim][eNoCuts] = new TH1F("[eHistVertexY][eSim][eNoCuts]", "Vertex Y (simulated) before cuts", nBinsVy, minVy, maxVy); - ec.fEventHistograms[eHistVertexY][eSim][eNoCuts]->GetXaxis()->SetTitle("Vertex Y"); + ec.fEventHistograms[eHistVertexY][eSim][eBefore] = new TH1F("[eHistVertexY][eSim][eBefore]", "Vertex Y (simulated) before cuts", nBinsVy, minVy, maxVy); + ec.fEventHistograms[eHistVertexY][eSim][eBefore]->GetXaxis()->SetTitle("Vertex Y"); - ec.fEventHistograms[eHistVertexZ][eSim][eNoCuts] = new TH1F("[eHistVertexZ][eSim][eNoCuts]", "Vertex Z (simulated) before cuts", nBinsVz, minVz, maxVz); - ec.fEventHistograms[eHistVertexZ][eSim][eNoCuts]->GetXaxis()->SetTitle("Vertex Z"); + ec.fEventHistograms[eHistVertexZ][eSim][eBefore] = new TH1F("[eHistVertexZ][eSim][eBefore]", "Vertex Z (simulated) before cuts", nBinsVz, minVz, maxVz); + ec.fEventHistograms[eHistVertexZ][eSim][eBefore]->GetXaxis()->SetTitle("Vertex Z"); - ec.fEventHistograms[eHistImpactParameter][eSim][eNoCuts] = new TH1F("[eHistImpactParameter][eSim][eNoCuts]", "Impact Parameter (simulated) before cuts", nBinsIp, minIp, maxIp); - ec.fEventHistograms[eHistImpactParameter][eSim][eNoCuts]->GetXaxis()->SetTitle("Impact Parameter"); + ec.fEventHistograms[eHistImpactParameter][eSim][eBefore] = new TH1F("[eHistImpactParameter][eSim][eBefore]", "Impact Parameter (simulated) before cuts", nBinsIp, minIp, maxIp); + ec.fEventHistograms[eHistImpactParameter][eSim][eBefore]->GetXaxis()->SetTitle("Impact Parameter"); for (int i = 0; i < eEventHistograms_N; ++i) { if (i != eHistReferenceMultiplicity) { - ec.fEventHistograms[i][eSim][eNoCuts]->SetColors(noCutLineColor, -1, noCutFillColor); - ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eSim][eNoCuts]); + ec.fEventHistograms[i][eSim][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); + ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eSim][eBefore]); } } if (cfMasterCutSwitch) { - ec.fEventHistograms[eHistCentrality][eSim][eWithCuts] = new TH1F("[eHistCentrality][eSim][eWithCuts]", "Centrality (simulated) after cuts", nBinsCent, minCent, maxCent); - ec.fEventHistograms[eHistCentrality][eSim][eWithCuts]->GetXaxis()->SetTitle("Centrality"); + ec.fEventHistograms[eHistCentrality][eSim][eAfter] = new TH1F("[eHistCentrality][eSim][eAfter]", "Centrality (simulated) after cuts", nBinsCent, minCent, maxCent); + ec.fEventHistograms[eHistCentrality][eSim][eAfter]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eSim][eWithCuts] = new TH1F("[eHistMultiplicity][eSim][eWithCuts]", "Multiplicity (simulated) after cuts", nBinsMultSim, minMultSim, maxMultSim); - ec.fEventHistograms[eHistMultiplicity][eSim][eWithCuts]->GetXaxis()->SetTitle("Multiplicity"); + ec.fEventHistograms[eHistMultiplicity][eSim][eAfter] = new TH1F("[eHistMultiplicity][eSim][eAfter]", "Multiplicity (simulated) after cuts", nBinsMultSim, minMultSim, maxMultSim); + ec.fEventHistograms[eHistMultiplicity][eSim][eAfter]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); - ec.fEventHistograms[eHistVertexX][eSim][eWithCuts] = new TH1F("[eHistVertexX][eSim][eWithCuts]", "Vertex X (simulated) after cuts", nBinsVx, minVx, maxVx); - ec.fEventHistograms[eHistVertexX][eSim][eWithCuts]->GetXaxis()->SetTitle("Vertex X"); + ec.fEventHistograms[eHistVertexX][eSim][eAfter] = new TH1F("[eHistVertexX][eSim][eAfter]", "Vertex X (simulated) after cuts", nBinsVx, minVx, maxVx); + ec.fEventHistograms[eHistVertexX][eSim][eAfter]->GetXaxis()->SetTitle("Vertex X"); - ec.fEventHistograms[eHistVertexY][eSim][eWithCuts] = new TH1F("[eHistVertexY][eSim][eWithCuts]", "Vertex Y (simulated) after cuts", nBinsVy, minVy, maxVy); - ec.fEventHistograms[eHistVertexY][eSim][eWithCuts]->GetXaxis()->SetTitle("Vertex Y"); + ec.fEventHistograms[eHistVertexY][eSim][eAfter] = new TH1F("[eHistVertexY][eSim][eAfter]", "Vertex Y (simulated) after cuts", nBinsVy, minVy, maxVy); + ec.fEventHistograms[eHistVertexY][eSim][eAfter]->GetXaxis()->SetTitle("Vertex Y"); - ec.fEventHistograms[eHistVertexZ][eSim][eWithCuts] = new TH1F("[eHistVertexZ][eSim][eWithCuts]", "Vertex Z (simulated) after cuts", nBinsVz, minVz, maxVz); - ec.fEventHistograms[eHistVertexZ][eSim][eWithCuts]->GetXaxis()->SetTitle("Vertex Z"); + ec.fEventHistograms[eHistVertexZ][eSim][eAfter] = new TH1F("[eHistVertexZ][eSim][eAfter]", "Vertex Z (simulated) after cuts", nBinsVz, minVz, maxVz); + ec.fEventHistograms[eHistVertexZ][eSim][eAfter]->GetXaxis()->SetTitle("Vertex Z"); - ec.fEventHistograms[eHistImpactParameter][eSim][eWithCuts] = new TH1F("[eHistImpactParameter][eSim][eWithCuts]", "Impact Parameter (simulated) after cuts", nBinsIp, minIp, maxIp); - ec.fEventHistograms[eHistImpactParameter][eSim][eWithCuts]->GetXaxis()->SetTitle("Impact Parameter"); + ec.fEventHistograms[eHistImpactParameter][eSim][eAfter] = new TH1F("[eHistImpactParameter][eSim][eAfter]", "Impact Parameter (simulated) after cuts", nBinsIp, minIp, maxIp); + ec.fEventHistograms[eHistImpactParameter][eSim][eAfter]->GetXaxis()->SetTitle("Impact Parameter"); for (int i = 0; i < eEventHistograms_N; ++i) { if (i != eHistReferenceMultiplicity) { - ec.fEventHistograms[i][eSim][eWithCuts]->SetColors(withCutLineColor, -1, withCutFillColor); - ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eSim][eWithCuts]); + ec.fEventHistograms[i][eSim][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); + ec.fEventHistogramsList->Add(ec.fEventHistograms[i][eSim][eAfter]); } } } @@ -1133,14 +1205,52 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to fBaseList->Add(obs.fObservablesList); if (doprocessRec || doprocessRecSim) { - obs.fProfTwo[eRec][eNoCuts] = new TProfile("obs.fProfTwo[eRec][eNoCuts]", "obs.fProfTwo[eRec][eNoCuts]", 1, 0., 1); - obs.fProfTwo[eRec][eNoCuts]->GetYaxis()->SetTitle("#LT#LTk#GT#GT / 10^{-k}"); - obs.fObservablesList->Add(obs.fProfTwo[eRec][eNoCuts]); + obs.fProfTwo[eRec][eBefore] = new TProfile("obs.fProfTwo[eRec][eBefore]", "obs.fProfTwo[eRec][eBefore]", 1, 0., 1); + obs.fProfTwo[eRec][eBefore]->GetYaxis()->SetTitle("#LT#LTk#GT#GT / 10^{-k}"); + obs.fObservablesList->Add(obs.fProfTwo[eRec][eBefore]); if (cfMasterCutSwitch) { - obs.fProfTwo[eRec][eWithCuts] = new TProfile("obs.fProfTwo[eRec][eWithCuts]", "obs.fProfTwo[eRec][eWithCuts]", 1, 0., 1); - obs.fProfTwo[eRec][eWithCuts]->GetYaxis()->SetTitle("#LT#LTk#GT#GT / 10^{-k}"); - obs.fObservablesList->Add(obs.fProfTwo[eRec][eWithCuts]); + obs.fProfTwo[eRec][eAfter] = new TProfile("obs.fProfTwo[eRec][eAfter]", "obs.fProfTwo[eRec][eAfter]", 1, 0., 1); + obs.fProfTwo[eRec][eAfter]->GetYaxis()->SetTitle("#LT#LTk#GT#GT / 10^{-k}"); + obs.fObservablesList->Add(obs.fProfTwo[eRec][eAfter]); + } + } + + if (doprocessRecSim) { + // *) Book PhiAndPtHistograms TLists: + pph.fPhiAndPtHistogramsList = new TList(); + pph.fPhiAndPtHistogramsList->SetName("PhiAndPtHistograms"); + pph.fPhiAndPtHistogramsList->SetOwner(true); + fBaseList->Add(pph.fPhiAndPtHistogramsList); + + pph.fPhiAndPtHistograms[ePhiRec][eBefore] = new TH1F("[ePhiRec][eBefore]", "phi distribution for reconstructed particles before cuts", nBinsPhi, minPhi, maxPhi); + pph.fPhiAndPtHistograms[ePhiRec][eBefore]->GetXaxis()->SetTitle("#varphi"); + + pph.fPhiAndPtHistograms[ePtRec][eBefore] = new TH1F("[ePtRec][eBefore]", "pt distribution for reconstructed particles before cuts", nBinsPt, minPt, maxPt); + pph.fPhiAndPtHistograms[ePhiRec][eBefore]->GetXaxis()->SetTitle("p_{T}"); + + pph.fPhiAndPtHistograms[ePtMC][eBefore] = new TH1F("[ePtMC][eBefore]", "pt distribution for simulated particles before cuts", nBinsPt, minPt, maxPt); + pph.fPhiAndPtHistograms[ePhiRec][eBefore]->GetXaxis()->SetTitle("p_{T}"); + + for (int i = 0; i < ePhiAndPtHistograms_N; ++i) { + pph.fPhiAndPtHistograms[i][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); + pph.fPhiAndPtHistogramsList->Add(pph.fPhiAndPtHistograms[i][eBefore]); + } + + if (cfMasterCutSwitch) { + pph.fPhiAndPtHistograms[ePhiRec][eAfter] = new TH1F("[ePhiRec][eAfter]", "phi distribution for reconstructed particles after cuts", nBinsPhi, minPhi, maxPhi); + pph.fPhiAndPtHistograms[ePhiRec][eAfter]->GetXaxis()->SetTitle("#varphi"); + + pph.fPhiAndPtHistograms[ePtRec][eAfter] = new TH1F("[ePtRec][eAfter]", "pt distribution for reconstructed particles after cuts", nBinsPt, minPt, maxPt); + pph.fPhiAndPtHistograms[ePhiRec][eAfter]->GetXaxis()->SetTitle("p_{T}"); + + pph.fPhiAndPtHistograms[ePtMC][eAfter] = new TH1F("[ePtMC][eAfter]", "pt distribution for simulated particles after cuts", nBinsPt, minPt, maxPt); + pph.fPhiAndPtHistograms[ePhiRec][eAfter]->GetXaxis()->SetTitle("p_{T}"); + + for (int i = 0; i < ePhiAndPtHistograms_N; ++i) { + pph.fPhiAndPtHistograms[i][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); + pph.fPhiAndPtHistogramsList->Add(pph.fPhiAndPtHistograms[i][eAfter]); + } } } From c02e16dad95f535a75a073d998864d108f63d864 Mon Sep 17 00:00:00 2001 From: Yuanjun Mei Date: Thu, 24 Sep 2026 19:53:55 +0200 Subject: [PATCH 2/4] Remove unnecessary hearder --- .../Tasks/multiparticleCorrelationsMei.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx index f85e20d179e..40fe0a76c9a 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include From bd0a1fa55aa955f8460e9960dbfb2c2277fadf1b Mon Sep 17 00:00:00 2001 From: Yuanjun Mei Date: Fri, 25 Sep 2026 14:11:50 +0200 Subject: [PATCH 3/4] Add charge histograms and rebinning for centrality histograms --- .../Tasks/multiparticleCorrelationsMei.cxx | 127 ++++++++++++------ 1 file changed, 84 insertions(+), 43 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx index 40fe0a76c9a..29065ea7b76 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx @@ -113,6 +113,7 @@ enum EParticleHistograms { eHistPt = 0, eHistPhi, eHistEta, + eHistCharge, eParticleHistograms_N }; @@ -193,19 +194,19 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to Configurable cfFileWithWeights{"cfFileWithWeights", "/alice-ccdb.cern.ch/Users/m/mei/O2challenge-", "path to external ROOT file which holds all particle weights"}; // *) binnings - Configurable> cfPtBins{"cfPtBins", {2000, 0., 5.}, "nPtBins, ptMin, ptMax"}; - Configurable> cfPhiBins{"cfPhiBins", {180, 0., math::TwoPI}, "nPhiBins, phiMin, phiMax"}; - Configurable> cfEtaBins{"cfEtaBins", {800, -3., 3.}, "nEtaBins, etaMin, etaMax"}; - - Configurable> cfMultBinsRec{"cfMultBinsRec", {400, 0., 40000.}, "nMultBins, multMin, multMax"}; - Configurable> cfMultBinsRef{"cfMultBinsRef", {400, 0., 40000.}, "nMultBins, multMin, multMax"}; - Configurable> cfMultBinsSim{"cfMultBinsSim", {400, 0., 40000.}, "nMultBins, multMin, multMax"}; + Configurable cfALICECentBinSwitch{"cfALICECentBinSwitch", true, "switch on or off to use ALICE default binning"}; + Configurable> cfCentBins{"cfCentBins", {100, 0., 100.}, "nCentBins, centMin, centMax"}; + Configurable> cfMultBins{"cfMultBins", {400, 0., 40000.}, "Multiplicity bins: nMultBins, multMin, multMax"}; + Configurable> cfMultBinsRef{"cfMultBinsRef", {400, 0., 40000.}, "Reference mult bins: nMultBins, multMin, multMax"}; Configurable> cfVxBins{"cfVxBins", {300, -0.04, 0.04}, "Vertex X hist: nVxBins, vxMin, vxMax"}; Configurable> cfVyBins{"cfVyBins", {300, -0.01, 0.01}, "Vertex Y hist: nVyBins, vyMin, vyMax"}; Configurable> cfVzBins{"cfVzBins", {300, -20., 20.}, "Vertex Z hist: nVzBins, vzMin, vzMax"}; - Configurable> cfCentBins{"cfCentBins", {100, 0., 100.}, "nCentBins, centMin, centMax"}; Configurable> cfIpBins{"cfIpBins", {100, 0., 20.}, "Impact parameters hist (MC only): nIPBins, ipMin, ipMax"}; + Configurable> cfPtBins{"cfPtBins", {2000, 0., 5.}, "nPtBins, ptMin, ptMax"}; + Configurable> cfPhiBins{"cfPhiBins", {180, 0., math::TwoPI}, "nPhiBins, phiMin, phiMax"}; + Configurable> cfEtaBins{"cfEtaBins", {800, -3., 3.}, "nEtaBins, etaMin, etaMax"}; + // *) Cuts // event level cuts Configurable cfMasterCutSwitch{"cfMasterCutSwitch", true, "switch on or off all cuts"}; @@ -746,12 +747,14 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to pc.fParticleHistograms[eHistPt][eRec][eBefore]->Fill(track.pt()); pc.fParticleHistograms[eHistPhi][eRec][eBefore]->Fill(track.phi()); pc.fParticleHistograms[eHistEta][eRec][eBefore]->Fill(track.eta()); + pc.fParticleHistograms[eHistCharge][eRec][eBefore]->Fill(track.sign()); } if constexpr (cuts == eAfter) { pc.fParticleHistograms[eHistPt][eRec][eAfter]->Fill(track.pt()); pc.fParticleHistograms[eHistPhi][eRec][eAfter]->Fill(track.phi()); pc.fParticleHistograms[eHistEta][eRec][eAfter]->Fill(track.eta()); + pc.fParticleHistograms[eHistCharge][eRec][eAfter]->Fill(track.sign()); } } @@ -761,10 +764,12 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to if constexpr (rs == eRecAndSim) { if (rm == eReal) { if constexpr (cuts == eBefore) { + pc.fParticleHistograms[eHistCharge][eSim][eBefore]->Fill(track.sign()); pph.fPhiAndPtHistograms[ePhiRec][eBefore]->Fill(track.phi()); pph.fPhiAndPtHistograms[ePtRec][eBefore]->Fill(track.pt()); } if constexpr (cuts == eAfter) { + pc.fParticleHistograms[eHistCharge][eSim][eAfter]->Fill(track.sign()); pph.fPhiAndPtHistograms[ePhiRec][eAfter]->Fill(track.phi()); pph.fPhiAndPtHistograms[ePtRec][eAfter]->Fill(track.pt()); } @@ -776,10 +781,15 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to return; } auto mcParticle = track.mcParticle(); + auto chargeMC = pdg->GetParticle(mcParticle.pdgCode())->Charge(); + if (std::abs(chargeMC) == 3) { + chargeMC /= 3; + } if constexpr (cuts == eBefore) { pc.fParticleHistograms[eHistPt][eSim][eBefore]->Fill(mcParticle.pt()); pc.fParticleHistograms[eHistPhi][eSim][eBefore]->Fill(mcParticle.phi()); pc.fParticleHistograms[eHistEta][eSim][eBefore]->Fill(mcParticle.eta()); + pc.fParticleHistograms[eHistCharge][eSim][eBefore]->Fill(chargeMC); pph.fPhiAndPtHistograms[ePtMC][eBefore]->Fill(mcParticle.pt()); } @@ -787,6 +797,7 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to pc.fParticleHistograms[eHistPt][eSim][eAfter]->Fill(mcParticle.pt()); pc.fParticleHistograms[eHistPhi][eSim][eAfter]->Fill(mcParticle.phi()); pc.fParticleHistograms[eHistEta][eSim][eAfter]->Fill(mcParticle.eta()); + pc.fParticleHistograms[eHistCharge][eSim][eAfter]->Fill(chargeMC); pph.fPhiAndPtHistograms[ePtMC][eAfter]->Fill(mcParticle.pt()); } } // end of if (rm == eMC) { @@ -977,31 +988,41 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to float minEta = lEtaBins[1]; float maxEta = lEtaBins[2]; + int nBinsCharge = 5; + float minCharge = -2.5; + float maxCharge = 2.5; + if (doprocessRec || doprocessRecSim) { - pc.fParticleHistograms[eHistPt][eRec][eBefore] = new TH1F("[eHistPt][eRec][eBefore]", "pt distribution for reconstructed particles before cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eRec][eBefore] = new TH1F("[eHistPt][eRec][eBefore]", "p_{T} distribution for reconstructed particles before cuts", nBinsPt, minPt, maxPt); pc.fParticleHistograms[eHistPt][eRec][eBefore]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eRec][eBefore] = new TH1F("[eHistPhi][eRec][eBefore]", "phi distribution for reconstructed particles before cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eRec][eBefore] = new TH1F("[eHistPhi][eRec][eBefore]", "#phi distribution for reconstructed particles before cuts", nBinsPhi, minPhi, maxPhi); pc.fParticleHistograms[eHistPhi][eRec][eBefore]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eRec][eBefore] = new TH1F("[eHistEta][eRec][eBefore]", "eta distribution for reconstructed particles before cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eRec][eBefore] = new TH1F("[eHistEta][eRec][eBefore]", "#eta distribution for reconstructed particles before cuts", nBinsEta, minEta, maxEta); pc.fParticleHistograms[eHistEta][eRec][eBefore]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistCharge][eRec][eBefore] = new TH1F("[eHistCharge][eRec][eBefore]", "charge distribution for reconstructed particles before cuts", nBinsCharge, minCharge, maxCharge); + pc.fParticleHistograms[eHistCharge][eRec][eBefore]->GetXaxis()->SetTitle("Particle charge"); + for (int i = 0; i < eParticleHistograms_N; ++i) { pc.fParticleHistograms[i][eRec][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eBefore]); } if (cfMasterCutSwitch) { - pc.fParticleHistograms[eHistPt][eRec][eAfter] = new TH1F("[eHistPt][eRec][eAfter]", "pt distribution for reconstructed particles after cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eRec][eAfter] = new TH1F("[eHistPt][eRec][eAfter]", "p_{T} distribution for reconstructed particles after cuts", nBinsPt, minPt, maxPt); pc.fParticleHistograms[eHistPt][eRec][eAfter]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eRec][eAfter] = new TH1F("[eHistPhi][eRec][eAfter]", "phi distribution for reconstructed particles after cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eRec][eAfter] = new TH1F("[eHistPhi][eRec][eAfter]", "#phi distribution for reconstructed particles after cuts", nBinsPhi, minPhi, maxPhi); pc.fParticleHistograms[eHistPhi][eRec][eAfter]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eRec][eAfter] = new TH1F("[eHistEta][eRec][eAfter]", "eta distribution for reconstructed particles after cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eRec][eAfter] = new TH1F("[eHistEta][eRec][eAfter]", "#eta distribution for reconstructed particles after cuts", nBinsEta, minEta, maxEta); pc.fParticleHistograms[eHistEta][eRec][eAfter]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistCharge][eRec][eAfter] = new TH1F("[eHistCharge][eRec][eAfter]", "charge distribution for reconstructed particles after cuts", nBinsCharge, minCharge, maxCharge); + pc.fParticleHistograms[eHistCharge][eRec][eAfter]->GetXaxis()->SetTitle("Particle charge"); + for (int i = 0; i < eParticleHistograms_N; ++i) { pc.fParticleHistograms[i][eRec][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eRec][eAfter]); @@ -1010,30 +1031,36 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } if (doprocessSim || doprocessRecSim) { - pc.fParticleHistograms[eHistPt][eSim][eBefore] = new TH1F("[eHistPt][eSim][eBefore]", "pt distribution for simulated particles before cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eSim][eBefore] = new TH1F("[eHistPt][eSim][eBefore]", "p_{T} distribution for simulated particles before cuts", nBinsPt, minPt, maxPt); pc.fParticleHistograms[eHistPt][eSim][eBefore]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eSim][eBefore] = new TH1F("[eHistPhi][eSim][eBefore]", "phi distribution for simulated particles before cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eSim][eBefore] = new TH1F("[eHistPhi][eSim][eBefore]", "#phi distribution for simulated particles before cuts", nBinsPhi, minPhi, maxPhi); pc.fParticleHistograms[eHistPhi][eSim][eBefore]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eSim][eBefore] = new TH1F("[eHistEta][eSim][eBefore]", "eta distribution for simulated particles before cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eSim][eBefore] = new TH1F("[eHistEta][eSim][eBefore]", "#eta distribution for simulated particles before cuts", nBinsEta, minEta, maxEta); pc.fParticleHistograms[eHistEta][eSim][eBefore]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistCharge][eSim][eBefore] = new TH1F("[eHistCharge][eSim][eBefore]", "charge distribution for simulated particles before cuts", nBinsCharge, minCharge, maxCharge); + pc.fParticleHistograms[eHistCharge][eSim][eBefore]->GetXaxis()->SetTitle("Particle charge"); + for (int i = 0; i < eParticleHistograms_N; ++i) { pc.fParticleHistograms[i][eSim][eBefore]->SetColors(beforeCutLineColor, -1, beforeCutFillColor); pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eBefore]); } if (cfMasterCutSwitch) { - pc.fParticleHistograms[eHistPt][eSim][eAfter] = new TH1F("[eHistPt][eSim][eAfter]", "pt distribution for simulated particles after cuts", nBinsPt, minPt, maxPt); + pc.fParticleHistograms[eHistPt][eSim][eAfter] = new TH1F("[eHistPt][eSim][eAfter]", "p_{T} distribution for simulated particles after cuts", nBinsPt, minPt, maxPt); pc.fParticleHistograms[eHistPt][eSim][eAfter]->GetXaxis()->SetTitle("p_{T}"); - pc.fParticleHistograms[eHistPhi][eSim][eAfter] = new TH1F("[eHistPhi][eSim][eAfter]", "phi distribution for simulated particles after cuts", nBinsPhi, minPhi, maxPhi); + pc.fParticleHistograms[eHistPhi][eSim][eAfter] = new TH1F("[eHistPhi][eSim][eAfter]", "#phi distribution for simulated particles after cuts", nBinsPhi, minPhi, maxPhi); pc.fParticleHistograms[eHistPhi][eSim][eAfter]->GetXaxis()->SetTitle("#varphi"); - pc.fParticleHistograms[eHistEta][eSim][eAfter] = new TH1F("[eHistEta][eSim][eAfter]", "eta distribution for simulated particles after cuts", nBinsEta, minEta, maxEta); + pc.fParticleHistograms[eHistEta][eSim][eAfter] = new TH1F("[eHistEta][eSim][eAfter]", "#eta distribution for simulated particles after cuts", nBinsEta, minEta, maxEta); pc.fParticleHistograms[eHistEta][eSim][eAfter]->GetXaxis()->SetTitle("#eta"); + pc.fParticleHistograms[eHistCharge][eSim][eAfter] = new TH1F("[eHistCharge][eSim][eAfter]", "charge distribution for simulated particles after cuts", nBinsCharge, minCharge, maxCharge); + pc.fParticleHistograms[eHistCharge][eSim][eAfter]->GetXaxis()->SetTitle("Particle charge"); + for (int i = 0; i < eParticleHistograms_N; ++i) { pc.fParticleHistograms[i][eSim][eAfter]->SetColors(afterCutLineColor, -1, afterCutFillColor); pc.fParticleHistogramsList->Add(pc.fParticleHistograms[i][eSim][eAfter]); @@ -1047,26 +1074,24 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to ec.fEventHistogramsList->SetOwner(true); fBaseList->Add(ec.fEventHistogramsList); + float defaultBoundaries[] = {0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; + const int nDefaultBins = sizeof(defaultBoundaries) / sizeof(defaultBoundaries[0]) - 1; + std::vector lCent = cfCentBins.value; int nBinsCent = static_cast(lCent[0]); float minCent = lCent[1]; float maxCent = lCent[2]; - std::vector lMultRec = cfMultBinsRec.value; - int nBinsMultRec = static_cast(lMultRec[0]); - float minMultRec = lMultRec[1]; - float maxMultRec = lMultRec[2]; + std::vector lMult = cfMultBins.value; + int nBinsMult = static_cast(lMult[0]); + float minMult = lMult[1]; + float maxMult = lMult[2]; std::vector lMultRef = cfMultBinsRef.value; int nBinsMultRef = static_cast(lMultRef[0]); float minMultRef = lMultRef[1]; float maxMultRef = lMultRef[2]; - std::vector lMultSim = cfMultBinsSim.value; - int nBinsMultSim = static_cast(lMultSim[0]); - float minMultSim = lMultSim[1]; - float maxMultSim = lMultSim[2]; - std::vector lVx = cfVxBins.value; int nBinsVx = static_cast(lVx[0]); float minVx = lVx[1]; @@ -1090,14 +1115,18 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to // eEventHistograms_N if (doprocessRec || doprocessRecSim) { - ec.fEventHistograms[eHistCentrality][eRec][eBefore] = new TH1F("[eHistCentrality][eRec][eBefore]", "Centrality (reconstructed) before cuts", nBinsCent, minCent, maxCent); + if (cfALICECentBinSwitch) { + ec.fEventHistograms[eHistCentrality][eRec][eBefore] = new TH1F("[eHistCentrality][eRec][eBefore]", "Centrality (reconstructed) before cuts", nDefaultBins, defaultBoundaries); + } else { + ec.fEventHistograms[eHistCentrality][eRec][eBefore] = new TH1F("[eHistCentrality][eRec][eBefore]", "Centrality (reconstructed) before cuts", nBinsCent, minCent, maxCent); + } ec.fEventHistograms[eHistCentrality][eRec][eBefore]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eRec][eBefore] = new TH1F("[eHistMultiplicity][eRec][eBefore]", "Multiplicity (reconstructed) before cuts", nBinsMultRec, minMultRec, maxMultRec); - ec.fEventHistograms[eHistMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); + ec.fEventHistograms[eHistMultiplicity][eRec][eBefore] = new TH1F("[eHistMultiplicity][eRec][eBefore]", "Multiplicity (reconstructed) before cuts", nBinsMult, minMult, maxMult); + ec.fEventHistograms[eHistMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle("Multiplicity"); ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore] = new TH1F("[eHistReferenceMultiplicity][eRec][eBefore]", "Reference Multiplicity before cuts", nBinsMultRef, minMultRef, maxMultRef); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle("Reference Multiplicity"); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eBefore]->GetXaxis()->SetTitle(Form("Reference Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); ec.fEventHistograms[eHistVertexX][eRec][eBefore] = new TH1F("[eHistVertexX][eRec][eBefore]", "Vertex X (reconstructed) before cuts", nBinsVx, minVx, maxVx); ec.fEventHistograms[eHistVertexX][eRec][eBefore]->GetXaxis()->SetTitle("Vertex X"); @@ -1116,14 +1145,18 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } if (cfMasterCutSwitch) { - ec.fEventHistograms[eHistCentrality][eRec][eAfter] = new TH1F("[eHistCentrality][eRec][eAfter]", "Centrality (reconstructed) after cuts", nBinsCent, minCent, maxCent); + if (cfALICECentBinSwitch) { + ec.fEventHistograms[eHistCentrality][eRec][eAfter] = new TH1F("[eHistCentrality][eRec][eAfter]", "Centrality (reconstructed) after cuts", nDefaultBins, defaultBoundaries); + } else { + ec.fEventHistograms[eHistCentrality][eRec][eAfter] = new TH1F("[eHistCentrality][eRec][eAfter]", "Centrality (reconstructed) after cuts", nBinsCent, minCent, maxCent); + } ec.fEventHistograms[eHistCentrality][eRec][eAfter]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eRec][eAfter] = new TH1F("[eHistMultiplicity][eRec][eAfter]", "Multiplicity (reconstructed) after cuts", nBinsMultRec, minMultRec, maxMultRec); - ec.fEventHistograms[eHistMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); + ec.fEventHistograms[eHistMultiplicity][eRec][eAfter] = new TH1F("[eHistMultiplicity][eRec][eAfter]", "Multiplicity (reconstructed) after cuts", nBinsMult, minMult, maxMult); + ec.fEventHistograms[eHistMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle("Multiplicity"); ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter] = new TH1F("[eHistReferenceMultiplicity][eRec][eAfter]", "Reference Multiplicity after cuts", nBinsMultRef, minMultRef, maxMultRef); - ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle("Reference Multiplicity"); + ec.fEventHistograms[eHistReferenceMultiplicity][eRec][eAfter]->GetXaxis()->SetTitle(Form("Reference Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); ec.fEventHistograms[eHistVertexX][eRec][eAfter] = new TH1F("[eHistVertexX][eRec][eAfter]", "Vertex X (reconstructed) after cuts", nBinsVx, minVx, maxVx); ec.fEventHistograms[eHistVertexX][eRec][eAfter]->GetXaxis()->SetTitle("Vertex X"); @@ -1144,11 +1177,15 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } if (doprocessSim || doprocessRecSim) { - ec.fEventHistograms[eHistCentrality][eSim][eBefore] = new TH1F("[eHistCentrality][eSim][eBefore]", "Centrality (simulated) before cuts", nBinsCent, minCent, maxCent); + if (cfALICECentBinSwitch) { + ec.fEventHistograms[eHistCentrality][eSim][eBefore] = new TH1F("[eHistCentrality][eSim][eBefore]", "Centrality (simulated) before cuts", nDefaultBins, defaultBoundaries); + } else { + ec.fEventHistograms[eHistCentrality][eSim][eBefore] = new TH1F("[eHistCentrality][eSim][eBefore]", "Centrality (simulated) before cuts", nBinsCent, minCent, maxCent); + } ec.fEventHistograms[eHistCentrality][eSim][eBefore]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eSim][eBefore] = new TH1F("[eHistMultiplicity][eSim][eBefore]", "Multiplicity (simulated) before cuts", nBinsMultSim, minMultSim, maxMultSim); - ec.fEventHistograms[eHistMultiplicity][eSim][eBefore]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); + ec.fEventHistograms[eHistMultiplicity][eSim][eBefore] = new TH1F("[eHistMultiplicity][eSim][eBefore]", "Multiplicity (simulated) before cuts", nBinsMult, minMult, maxMult); + ec.fEventHistograms[eHistMultiplicity][eSim][eBefore]->GetXaxis()->SetTitle("Multiplicity"); ec.fEventHistograms[eHistVertexX][eSim][eBefore] = new TH1F("[eHistVertexX][eSim][eBefore]", "Vertex X (simulated) before cuts", nBinsVx, minVx, maxVx); ec.fEventHistograms[eHistVertexX][eSim][eBefore]->GetXaxis()->SetTitle("Vertex X"); @@ -1170,11 +1207,15 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } if (cfMasterCutSwitch) { - ec.fEventHistograms[eHistCentrality][eSim][eAfter] = new TH1F("[eHistCentrality][eSim][eAfter]", "Centrality (simulated) after cuts", nBinsCent, minCent, maxCent); + if (cfALICECentBinSwitch) { + ec.fEventHistograms[eHistCentrality][eSim][eAfter] = new TH1F("[eHistCentrality][eSim][eAfter]", "Centrality (simulated) after cuts", nDefaultBins, defaultBoundaries); + } else { + ec.fEventHistograms[eHistCentrality][eSim][eAfter] = new TH1F("[eHistCentrality][eSim][eAfter]", "Centrality (simulated) after cuts", nBinsCent, minCent, maxCent); + } ec.fEventHistograms[eHistCentrality][eSim][eAfter]->GetXaxis()->SetTitle(Form("Centrality (%s)", CentralityEstimatorNames[centralityEstimator])); - ec.fEventHistograms[eHistMultiplicity][eSim][eAfter] = new TH1F("[eHistMultiplicity][eSim][eAfter]", "Multiplicity (simulated) after cuts", nBinsMultSim, minMultSim, maxMultSim); - ec.fEventHistograms[eHistMultiplicity][eSim][eAfter]->GetXaxis()->SetTitle(Form("Multiplicity (%s)", MultiplicityTablesNames[multiplicityTables])); + ec.fEventHistograms[eHistMultiplicity][eSim][eAfter] = new TH1F("[eHistMultiplicity][eSim][eAfter]", "Multiplicity (simulated) after cuts", nBinsMult, minMult, maxMult); + ec.fEventHistograms[eHistMultiplicity][eSim][eAfter]->GetXaxis()->SetTitle("Multiplicity"); ec.fEventHistograms[eHistVertexX][eSim][eAfter] = new TH1F("[eHistVertexX][eSim][eAfter]", "Vertex X (simulated) after cuts", nBinsVx, minVx, maxVx); ec.fEventHistograms[eHistVertexX][eSim][eAfter]->GetXaxis()->SetTitle("Vertex X"); From c4b051fc10f12f55006ce42dbd9c6f8ab260f09b Mon Sep 17 00:00:00 2001 From: Yuanjun Mei Date: Fri, 25 Sep 2026 14:23:01 +0200 Subject: [PATCH 4/4] Remove magic number --- .../Tasks/multiparticleCorrelationsMei.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx index 29065ea7b76..ef6af20e12d 100644 --- a/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx +++ b/PWGCF/MultiparticleCorrelations/Tasks/multiparticleCorrelationsMei.cxx @@ -782,8 +782,9 @@ struct MultiparticleCorrelationsMei // this name is used in lower-case format to } auto mcParticle = track.mcParticle(); auto chargeMC = pdg->GetParticle(mcParticle.pdgCode())->Charge(); - if (std::abs(chargeMC) == 3) { - chargeMC /= 3; + const int chargeMCUnit = 3; + if (std::abs(chargeMC) == chargeMCUnit) { + chargeMC /= chargeMCUnit; } if constexpr (cuts == eBefore) { pc.fParticleHistograms[eHistPt][eSim][eBefore]->Fill(mcParticle.pt());